home *** CD-ROM | disk | FTP | other *** search
/ Power Programmierung 2 / Power-Programmierung CD 2 (Tewi)(1994).iso / gnu / gnulib / sipp / doc / texinfo.tex < prev   
Encoding:
Text File  |  1992-03-10  |  89.6 KB  |  2,862 lines

  1. %% TeX macros to handle texinfo files
  2.  
  3. %   Copyright (C) 1985, 1986, 1988, 1990, 1991 Free Software Foundation, Inc.
  4.  
  5. %This texinfo.tex file is free software; you can redistribute it and/or
  6. %modify it under the terms of the GNU General Public License as
  7. %published by the Free Software Foundation; either version 2, or (at
  8. %your option) any later version.
  9.  
  10. %This texinfo.tex file is distributed in the hope that it will be
  11. %useful, but WITHOUT ANY WARRANTY; without even the implied warranty
  12. %of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  13. %General Public License for more details.
  14.  
  15. %You should have received a copy of the GNU General Public License
  16. %along with this texinfo.tex file; see the file COPYING.  If not, write
  17. %to the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139,
  18. %USA.
  19.  
  20.  
  21. %In other words, you are welcome to use, share and improve this program.
  22. %You are forbidden to forbid anyone else to use, share and improve
  23. %what you give them.   Help stamp out software-hoarding!
  24.  
  25. \def\texinfoversion{2.46}
  26. \message{Loading texinfo package [Version \texinfoversion]:}
  27. \message{}
  28.  
  29. % Print the version number if in a .fmt file.
  30. \everyjob{\message{[Texinfo version \texinfoversion]}\message{}}
  31.  
  32. % Save some parts of plain tex whose names we will redefine.
  33.  
  34. \let\ptexlbrace=\{
  35. \let\ptexrbrace=\}
  36. \let\ptexdots=\dots
  37. \let\ptexdot=\.
  38. \let\ptexstar=\*
  39. \let\ptexend=\end
  40. \let\ptexbullet=\bullet
  41. \let\ptexb=\b
  42. \let\ptexc=\c
  43. \let\ptexi=\i
  44. \let\ptext=\t
  45. \let\ptexl=\l
  46. \let\ptexL=\L
  47.  
  48. \def\tie{\penalty 10000\ }     % Save plain tex definition of ~.
  49.  
  50. \message{Basics,}
  51. \chardef\other=12
  52.  
  53. \hyphenation{ap-pen-dix}
  54. \hyphenation{mini-buf-fer mini-buf-fers}
  55. \hyphenation{eshell}
  56.  
  57. % Margin to add to right of even pages, to left of odd pages.
  58. \newdimen \bindingoffset  \bindingoffset=0pt
  59. \newdimen \normaloffset   \normaloffset=\hoffset
  60. \newdimen\pagewidth \newdimen\pageheight
  61. \pagewidth=\hsize \pageheight=\vsize
  62.  
  63. %---------------------Begin change-----------------------
  64. %
  65. % Dimensions to add cropmarks at corners Added by P. A. MacKay, 12 Nov. 1986
  66. %
  67. \newdimen\cornerlong \newdimen\cornerthick
  68. \newdimen \topandbottommargin
  69. \newdimen \outerhsize \newdimen \outervsize
  70. \cornerlong=1pc\cornerthick=.3pt    % These set size of cropmarks
  71. \outerhsize=7in
  72. \outervsize=9.5in
  73. \topandbottommargin=.75in
  74. %
  75. %---------------------End change-----------------------
  76.  
  77. % \onepageout takes a vbox as an argument.  Note that \pagecontents
  78. % does insertions itself, but you have to call it yourself.
  79. \chardef\PAGE=255  \output={\onepageout{\pagecontents\PAGE}}
  80. \def\onepageout#1{\hoffset=\normaloffset
  81. \ifodd\pageno  \advance\hoffset by \bindingoffset
  82. \else \advance\hoffset by -\bindingoffset\fi
  83. {\escapechar=`\\\relax % makes sure backslash is used in output files.
  84. \shipout\vbox{{\let\hsize=\pagewidth \makeheadline} \pagebody{#1}%
  85. {\let\hsize=\pagewidth \makefootline}}}%
  86. \advancepageno \ifnum\outputpenalty>-20000 \else\dosupereject\fi}
  87.  
  88.  
  89. % Here is a modification of the main output routine for Near East Publications
  90. % This provides right-angle cropmarks at all four corners.
  91. % The contents of the page are centerlined into the cropmarks,
  92. % and any desired binding offset is added as an \hskip on either
  93. % site of the centerlined box.  (P. A. MacKay, 12 November, 1986)
  94. %
  95. \def\croppageout#1{\hoffset=0pt % make sure this doesn't mess things up
  96.          \shipout
  97.          \vbox to \outervsize{\hsize=\outerhsize
  98.                  \vbox{\line{\ewtop\hfill\ewtop}}
  99.                  \nointerlineskip
  100.                  \line{\vbox{\moveleft\cornerthick\nstop}
  101.                        \hfill
  102.                        \vbox{\moveright\cornerthick\nstop}}
  103.                  \vskip \topandbottommargin
  104.                  \centerline{\ifodd\pageno\hskip\bindingoffset\fi
  105.             \vbox{
  106.             {\let\hsize=\pagewidth \makeheadline}
  107.             \pagebody{#1}
  108.             {\let\hsize=\pagewidth \makefootline}}
  109.             \ifodd\pageno\else\hskip\bindingoffset\fi}
  110.          \vskip \topandbottommargin plus1fill minus1fill
  111.                  \boxmaxdepth\cornerthick
  112.                  \line{\vbox{\moveleft\cornerthick\nsbot}
  113.                        \hfill
  114.                        \vbox{\moveright\cornerthick\nsbot}}
  115.                  \nointerlineskip
  116.                  \vbox{\line{\ewbot\hfill\ewbot}}
  117.     }
  118.   \advancepageno 
  119.   \ifnum\outputpenalty>-20000 \else\dosupereject\fi}
  120. %
  121. % Do @cropmarks to get crop marks
  122. \def\cropmarks{\let\onepageout=\croppageout }
  123.  
  124. \def\pagebody#1{\vbox to\pageheight{\boxmaxdepth=\maxdepth #1}}
  125. {\catcode`\@ =11
  126. \gdef\pagecontents#1{\ifvoid\topins\else\unvbox\topins\fi
  127. \dimen@=\dp#1 \unvbox#1
  128. \ifvoid\footins\else\vskip\skip\footins\footnoterule \unvbox\footins\fi
  129. \ifr@ggedbottom \kern-\dimen@ \vfil \fi}
  130. }
  131.  
  132. %
  133. % Here are the rules for the cropmarks.  Note that they are
  134. % offset so that the space between them is truly \outerhsize or \outervsize
  135. % (P. A. MacKay, 12 November, 1986)
  136. %
  137. \def\ewtop{\vrule height\cornerthick depth0pt width\cornerlong}
  138. \def\nstop{\vbox
  139.   {\hrule height\cornerthick depth\cornerlong width\cornerthick}}
  140. \def\ewbot{\vrule height0pt depth\cornerthick width\cornerlong}
  141. \def\nsbot{\vbox
  142.   {\hrule height\cornerlong depth\cornerthick width\cornerthick}}
  143.  
  144. % Parse an argument, then pass it to #1.
  145. % The argument can be delimited with [...] or with "..." or braces
  146. % or it can be a whole line.
  147. % #1 should be a macro which expects
  148. % an ordinary undelimited TeX argument.
  149.  
  150. \def\parsearg #1{\let\next=#1\begingroup\obeylines\futurelet\temp\parseargx}
  151.  
  152. \def\parseargx{%
  153. \ifx \obeyedspace\temp \aftergroup\parseargdiscardspace \else%
  154. \aftergroup \parseargline %
  155. \fi \endgroup}
  156.  
  157. {\obeyspaces %
  158. \gdef\parseargdiscardspace {\begingroup\obeylines\futurelet\temp\parseargx}}
  159.  
  160. \gdef\obeyedspace{\ }
  161.  
  162. \def\parseargline{\begingroup \obeylines \parsearglinex}
  163. {\obeylines %
  164. \gdef\parsearglinex #1^^M{\endgroup \next {#1}}}
  165.  
  166. \def\flushcr{\ifx\par\lisppar \def\next##1{}\else \let\next=\relax \fi \next}
  167.  
  168. %% These are used to keep @begin/@end levels from running away
  169. %% Call \inENV within environments (after a \begingroup)
  170. \newif\ifENV \ENVfalse \def\inENV{\ifENV\relax\else\ENVtrue\fi}
  171. \def\ENVcheck{%
  172. \ifENV\errmessage{Still within an environment.  Type Return to continue.}
  173. \endgroup\fi} % This is not perfect, but it should reduce lossage
  174.  
  175. % @begin foo  is the same as @foo, for now.
  176. \newhelp\EMsimple{Type <Return> to continue}
  177.  
  178. \outer\def\begin{\parsearg\beginxxx}
  179.  
  180. \def\beginxxx #1{%
  181. \expandafter\ifx\csname #1\endcsname\relax
  182. {\errhelp=\EMsimple \errmessage{Undefined command @begin #1}}\else
  183. \csname #1\endcsname\fi}
  184.  
  185. %% @end foo executes the definition of \Efoo.
  186. %% foo can be delimited by doublequotes or brackets.
  187.  
  188. \def\end{\parsearg\endxxx}
  189.  
  190. \def\endxxx #1{%
  191. \expandafter\ifx\csname E#1\endcsname\relax
  192. \expandafter\ifx\csname #1\endcsname\relax
  193. \errmessage{Undefined command @end #1}\else
  194. \errorE{#1}\fi\fi
  195. \csname E#1\endcsname}
  196. \def\errorE#1{
  197. {\errhelp=\EMsimple \errmessage{@end #1 not within #1 environment}}}
  198.  
  199. % Single-spacing is done by various environments.
  200.  
  201. \newskip\singlespaceskip \singlespaceskip = \baselineskip
  202. \def\singlespace{%
  203. {\advance \baselineskip by -\singlespaceskip
  204. \kern \baselineskip}%
  205. \baselineskip=\singlespaceskip
  206. }
  207.  
  208. %% Simple single-character @ commands
  209.  
  210. % @@ prints an @
  211. % Kludge this until the fonts are right (grr).
  212. \def\@{{\tt \char '100}}
  213.  
  214. % Define @` and @' to be the same as ` and '
  215. % but suppressing ligatures.
  216. \def\`{{`}}
  217. \def\'{{'}}
  218.  
  219. % Used to generate quoted braces.
  220.  
  221. \def\mylbrace {{\tt \char '173}}
  222. \def\myrbrace {{\tt \char '175}}
  223. \let\{=\mylbrace
  224. \let\}=\myrbrace
  225.  
  226. % @: forces normal size whitespace following.
  227. \def\:{\spacefactor=1000 }
  228.  
  229. % @* forces a line break.
  230. \def\*{\hfil\break\hbox{}\ignorespaces}
  231.  
  232. % @. is an end-of-sentence period.
  233. \def\.{.\spacefactor=3000 }
  234.  
  235. % @w prevents a word break
  236. \def\w #1{\hbox{#1}}
  237.  
  238. % @group ... @end group  forces ... to be all on one page.
  239.  
  240. \def\group{\begingroup% \inENV ???
  241. \def \Egroup{\egroup\endgroup}
  242. \vbox\bgroup}
  243.  
  244. % @need space-in-mils
  245. % forces a page break if there is not space-in-mils remaining.
  246.  
  247. \newdimen\mil  \mil=0.001in
  248.  
  249. \def\need{\parsearg\needx}
  250.  
  251. \def\needx #1{\par %
  252. % This method tries to make TeX break the page naturally
  253. % if the depth of the box does not fit.
  254. {\baselineskip=0pt%
  255. \vtop to #1\mil{\vfil}\kern -#1\mil\penalty 10000
  256. \prevdepth=-1000pt
  257. }}
  258.  
  259. % @br   forces paragraph break
  260.  
  261. \let\br = \par
  262.  
  263. % @dots{}  output some dots
  264.  
  265. \def\dots{$\ldots$}
  266.  
  267. % @page    forces the start of a new page
  268.  
  269. \def\page{\par\vfill\supereject}
  270.  
  271. % @exdent text....
  272. % outputs text on separate line in roman font, starting at standard page margin
  273.  
  274. \def\exdent{\errmessage{@exdent in filled text}}
  275.   % @lisp, etc, define \exdent locally from \internalexdent
  276.  
  277. {\obeyspaces
  278. \gdef\internalexdent{\parsearg\exdentzzz}}
  279.  
  280. \def\exdentzzz #1{{\advance \leftskip by -\lispnarrowing
  281. \advance \hsize by -\leftskip
  282. \advance \hsize by -\rightskip
  283. \leftline{{\rm#1}}}}
  284.  
  285. % @include file    insert text of that file as input.
  286.  
  287. \def\include{\parsearg\includezzz}
  288. \def\includezzz #1{{\def\thisfile{#1}\input #1
  289. }}
  290.  
  291. \def\thisfile{}
  292.  
  293. % @center line   outputs that line, centered
  294.  
  295. \def\center{\parsearg\centerzzz}
  296. \def\centerzzz #1{{\advance\hsize by -\leftskip
  297. \advance\hsize by -\rightskip
  298. \centerline{#1}}}
  299.  
  300. % @sp n   outputs n lines of vertical space
  301.  
  302. \def\sp{\parsearg\spxxx}
  303. \def\spxxx #1{\par \vskip #1\baselineskip}
  304.  
  305. % @comment ...line which is ignored...
  306. % @c is the same as @comment
  307. % @ignore ... @end ignore  is another way to write a comment
  308.  
  309. \def\comment{\catcode 64=\other \catcode 123=\other \catcode 125=\other%
  310. \parsearg \commentxxx}
  311.  
  312. \def\commentxxx #1{\catcode 64=0 \catcode 123=1 \catcode 125=2 }
  313.  
  314. \let\c=\comment
  315.  
  316. % Prevent errors for section commands.
  317. % Used in @ignore and in failing conditionals.
  318. \def\ignoresections{%
  319. \let\chapter=\relax
  320. \let\unnumbered=\relax
  321. \let\top=\relax
  322. \let\unnumberedsec=\relax
  323. \let\unnumberedsection=\relax
  324. \let\unnumberedsubsec=\relax
  325. \let\unnumberedsubsection=\relax
  326. \let\unnumberedsubsubsec=\relax
  327. \let\unnumberedsubsubsection=\relax
  328. \let\section=\relax
  329. \let\subsec=\relax
  330. \let\subsubsec=\relax
  331. \let\subsection=\relax
  332. \let\subsubsection=\relax
  333. \let\appendix=\relax
  334. \let\appendixsec=\relax
  335. \let\appendixsection=\relax
  336. \let\appendixsubsec=\relax
  337. \let\appendixsubsection=\relax
  338. \let\appendixsubsubsec=\relax
  339. \let\appendixsubsubsection=\relax
  340. \let\contents=\relax
  341. \let\smallbook=\relax
  342. \let\titlepage=\relax
  343. }
  344.  
  345. \def\ignore{\begingroup\ignoresections
  346. % Make sure that spaces turn into tokens that match what \ignorexxx wants.
  347. \catcode32=10
  348. \ignorexxx}
  349. \long\def\ignorexxx #1\end ignore{\endgroup\ignorespaces}
  350.  
  351. \def\direntry{\begingroup\direntryxxx}
  352. \long\def\direntryxxx #1\end direntry{\endgroup\ignorespaces}
  353.  
  354. % Conditionals to test whether a flag is set.
  355.  
  356. \outer\def\ifset{\begingroup\ignoresections\parsearg\ifsetxxx}
  357.  
  358. \def\ifsetxxx #1{\endgroup
  359. \expandafter\ifx\csname IF#1\endcsname\relax \let\temp=\ifsetfail
  360. \else \let\temp=\relax \fi
  361. \temp}
  362. \def\Eifset{}
  363. \def\ifsetfail{\begingroup\ignoresections\ifsetfailxxx}
  364. \long\def\ifsetfailxxx #1\end ifset{\endgroup\ignorespaces}
  365.  
  366. \outer\def\ifclear{\begingroup\ignoresections\parsearg\ifclearxxx}
  367.  
  368. \def\ifclearxxx #1{\endgroup
  369. \expandafter\ifx\csname IF#1\endcsname\relax \let\temp=\relax
  370. \else \let\temp=\ifclearfail \fi
  371. \temp}
  372. \def\Eifclear{}
  373. \def\ifclearfail{\begingroup\ignoresections\ifclearfailxxx}
  374. \long\def\ifclearfailxxx #1\end ifclear{\endgroup\ignorespaces}
  375.  
  376. % Some texinfo constructs that are trivial in tex
  377.  
  378. \def\iftex{}
  379. \def\Eiftex{}
  380. \def\ifinfo{\begingroup\ignoresections\ifinfoxxx}
  381. \long\def\ifinfoxxx #1\end ifinfo{\endgroup\ignorespaces}
  382.  
  383. \long\def\menu #1\end menu{}
  384. \def\asis#1{#1}
  385.  
  386. % @math means output in math mode.
  387. % We don't use $'s directly in the definition of \math because control
  388. % sequences like \math are expanded when the toc file is written.  Then,
  389. % we read the toc file back, the $'s will be normal characters (as they
  390. % should be, according to the definition of Texinfo).  So we must use a
  391. % control sequence to switch into and out of math mode.
  392. % This isn't quite enough for @math to work properly in indices, but it
  393. % seems unlikely it will ever be needed there.
  394. \let\implicitmath = $
  395. \def\math#1{\implicitmath #1\implicitmath}
  396.  
  397. \def\node{\ENVcheck\parsearg\nodezzz}
  398. \def\nodezzz#1{\nodexxx [#1,]}
  399. \def\nodexxx[#1,#2]{\gdef\lastnode{#1}}
  400. \let\lastnode=\relax
  401.  
  402. \def\donoderef{\ifx\lastnode\relax\else
  403. \expandafter\expandafter\expandafter\setref{\lastnode}\fi
  404. \let\lastnode=\relax}
  405.  
  406. \def\unnumbnoderef{\ifx\lastnode\relax\else
  407. \expandafter\expandafter\expandafter\unnumbsetref{\lastnode}\fi
  408. \let\lastnode=\relax}
  409.  
  410. \def\appendixnoderef{\ifx\lastnode\relax\else
  411. \expandafter\expandafter\expandafter\appendixsetref{\lastnode}\fi
  412. \let\lastnode=\relax}
  413.  
  414. \let\refill=\relax
  415.   
  416. % @setfilename is done at the beginning of every texinfo file.
  417. % So open here the files we need to have open while reading the input.
  418. % This makes it possible to make a .fmt file for texinfo.
  419. \def\setfilename{%
  420.    \readauxfile
  421.    \opencontents
  422.    \openindices
  423.    \fixbackslash  % Turn off hack to swallow `\input texinfo'.
  424.    \global\let\setfilename=\comment % Ignore extra @setfilename cmds.
  425.    \comment % Ignore the actual filename.
  426. }
  427.  
  428. \outer\def\bye{\pagealignmacro\tracingstats=1\ptexend}
  429.  
  430. \def\inforef #1{\inforefzzz #1,,,,**}
  431. \def\inforefzzz #1,#2,#3,#4**{See Info file \file{\losespace#3{}},
  432.   node \samp{\losespace#1{}}}
  433. \def\losespace #1{#1}
  434.  
  435. \message{fonts,}
  436.  
  437. % Font-change commands.
  438.  
  439. % Texinfo supports the sans serif font style, which plain TeX does not.
  440. % So we set up a \sf analogous to plain's \rm, etc.
  441. \newfam\sffam
  442. \def\sf{\fam=\sffam \tensf}
  443. \let\li = \sf % Sometimes we call it \li, not \sf.
  444.  
  445. %% Try out Computer Modern fonts at \magstephalf
  446. \font\textrm=cmr10 scaled \magstephalf
  447. \font\texttt=cmtt10 scaled \magstephalf
  448. % Instead of cmb10, you many want to use cmbx10.
  449. % cmbx10 is a prettier font on its own, but cmb10
  450. % looks better when embedded in a line with cmr10.
  451. \font\textbf=cmb10 scaled \magstephalf 
  452. \font\textit=cmti10 scaled \magstephalf
  453. \font\textsl=cmsl10 scaled \magstephalf
  454. \font\textsf=cmss10 scaled \magstephalf
  455. \font\textsc=cmcsc10 scaled \magstephalf
  456. \font\texti=cmmi10 scaled \magstephalf
  457. \font\textsy=cmsy10 scaled \magstephalf
  458.  
  459. % A few fonts for @defun, etc.
  460. \font\defbf=cmbx10 scaled \magstep1 %was 1314
  461. \font\deftt=cmtt10 scaled \magstep1
  462. \def\df{\let\tentt=\deftt \let\tenbf = \defbf \bf}
  463.  
  464. % Fonts for indices and small examples.
  465. % We actually use the slanted font rather than the italic, 
  466. % because texinfo normally uses the slanted fonts for that.
  467. % Do not make many font distinctions in general in the index, since they
  468. % aren't very useful.
  469. \font\ninett=cmtt9
  470. \font\indrm=cmr9
  471. \font\indit=cmsl9
  472. \let\indsl=\indit
  473. \let\indtt=\ninett
  474. \let\indsf=\indrm
  475. \let\indbf=\indrm
  476. \let\indsc=\indrm
  477. \font\indi=cmmi9
  478. \font\indsy=cmsy9
  479.  
  480. % Fonts for headings
  481. \font\chaprm=cmbx12 scaled \magstep2
  482. \font\chapit=cmti12 scaled \magstep2
  483. \font\chapsl=cmsl12 scaled \magstep2
  484. \font\chaptt=cmtt12 scaled \magstep2
  485. \font\chapsf=cmss12 scaled \magstep2
  486. \let\chapbf=\chaprm
  487. \font\chapsc=cmcsc10 scaled\magstep3
  488. \font\chapi=cmmi12 scaled \magstep2
  489. \font\chapsy=cmsy10 scaled \magstep3
  490.  
  491. \font\secrm=cmbx12 scaled \magstep1
  492. \font\secit=cmti12 scaled \magstep1
  493. \font\secsl=cmsl12 scaled \magstep1
  494. \font\sectt=cmtt12 scaled \magstep1
  495. \font\secsf=cmss12 scaled \magstep1
  496. \font\secbf=cmbx12 scaled \magstep1
  497. \font\secsc=cmcsc10 scaled\magstep2
  498. \font\seci=cmmi12 scaled \magstep1
  499. \font\secsy=cmsy10 scaled \magstep2
  500.  
  501. % \font\ssecrm=cmbx10 scaled \magstep1    % This size an font looked bad.
  502. % \font\ssecit=cmti10 scaled \magstep1    % The letters were too crowded.
  503. % \font\ssecsl=cmsl10 scaled \magstep1
  504. % \font\ssectt=cmtt10 scaled \magstep1
  505. % \font\ssecsf=cmss10 scaled \magstep1
  506.  
  507. %\font\ssecrm=cmb10 scaled 1315    % Note the use of cmb rather than cmbx.
  508. %\font\ssecit=cmti10 scaled 1315    % Also, the size is a little larger than
  509. %\font\ssecsl=cmsl10 scaled 1315    % being scaled magstep1.
  510. %\font\ssectt=cmtt10 scaled 1315
  511. %\font\ssecsf=cmss10 scaled 1315
  512.  
  513. %\let\ssecbf=\ssecrm
  514.  
  515. \font\ssecrm=cmbx12 scaled \magstephalf
  516. \font\ssecit=cmti12 scaled \magstephalf
  517. \font\ssecsl=cmsl12 scaled \magstephalf
  518. \font\ssectt=cmtt12 scaled \magstephalf
  519. \font\ssecsf=cmss12 scaled \magstephalf
  520. \font\ssecbf=cmbx12 scaled \magstephalf
  521. \font\ssecsc=cmcsc10 scaled \magstep1 
  522. \font\sseci=cmmi12 scaled \magstephalf
  523. \font\ssecsy=cmsy10 scaled \magstep1
  524. % The smallcaps and symbol fonts should actually be scaled \magstep1.5,
  525. % but that is not a standard magnification.
  526.  
  527. % Fonts for title page:
  528. \font\titlerm = cmbx12 scaled \magstep3
  529. \let\authorrm = \secrm
  530.  
  531. % In order for the font changes to affect most math symbols and letters,
  532. % we have to define the \textfont of the standard families.  Since
  533. % texinfo doesn't allow for producing subscripts and superscripts, we
  534. % don't bother to reset \scriptfont and \scriptscriptfont (which would
  535. % also require loading a lot more fonts).
  536. \def\resetmathfonts{%
  537.   \textfont0 = \tenrm \textfont1 = \teni \textfont2 = \tensy
  538.   \textfont\itfam = \tenit \textfont\slfam = \tensl \textfont\bffam = \tenbf
  539.   \textfont\ttfam = \tentt \textfont\sffam = \tensf
  540. }
  541.  
  542.  
  543. % The font-changing commands redefine the meanings of \tenSTYLE, instead
  544. % of just \STYLE.  We do this so that font changes will continue to work
  545. % in math mode, where it is the current \fam that is relevant in most
  546. % cases, not the current.  Plain TeX does, for example,
  547. % \def\bf{\fam=\bffam \tenbf}  By redefining \tenbf, we obviate the need
  548. % to redefine \bf itself.  
  549. \def\textfonts{%
  550.   \let\tenrm=\textrm \let\tenit=\textit \let\tensl=\textsl
  551.   \let\tenbf=\textbf \let\tentt=\texttt \let\smallcaps=\textsc
  552.   \let\tensf=\textsf \let\teni=\texti \let\tensy=\textsy
  553.   \resetmathfonts}
  554. \def\chapfonts{%
  555.   \let\tenrm=\chaprm \let\tenit=\chapit \let\tensl=\chapsl 
  556.   \let\tenbf=\chapbf \let\tentt=\chaptt \let\smallcaps=\chapsc
  557.   \let\tensf=\chapsf \let\teni=\chapi \let\tensy=\chapsy
  558.   \resetmathfonts}
  559. \def\secfonts{%
  560.   \let\tenrm=\secrm \let\tenit=\secit \let\tensl=\secsl
  561.   \let\tenbf=\secbf \let\tentt=\sectt \let\smallcaps=\sectt
  562.   \let\tensf=\secsf \let\teni=\seci \let\tensy=\secsy
  563.   \resetmathfonts}
  564. \def\subsecfonts{%
  565.   \let\tenrm=\ssecrm \let\tenit=\ssecit \let\tensl=\ssecsl
  566.   \let\tenbf=\ssecbf \let\tentt=\ssectt \let\smallcaps=\ssecsc
  567.   \let\tensf=\ssecsf \let\teni=\sseci \let\tensy=\ssecsy
  568.   \resetmathfonts}
  569. \def\indexfonts{%
  570.   \let\tenrm=\indrm \let\tenit=\tenit \let\tensl=\indsl
  571.   \let\tenbf=\indbf \let\tentt=\indtt \let\smallcaps=\indsc
  572.   \let\tensf=\indsf \let\teni=\indi \let\tensy=\indsy
  573.   \resetmathfonts}
  574.  
  575. % Set up the default fonts, so we can use them for creating boxes.
  576. \textfonts
  577.  
  578. % Count depth in font-changes, for error checks
  579. \newcount\fontdepth \fontdepth=0
  580.  
  581. % Fonts for short table of contents.
  582. \font\shortcontrm=cmr12
  583. \font\shortcontbf=cmbx12
  584. \font\shortcontsl=cmsl12
  585.  
  586. %% Add scribe-like font environments, plus @l for inline lisp (usually sans
  587. %% serif) and @ii for TeX italic
  588.  
  589. % \smartitalic{ARG} outputs arg in italics, followed by an italic correction
  590. % unless the following character is such as not to need one.
  591. \def\smartitalicx{\ifx\next,\else\ifx\next-\else\ifx\next.\else\/\fi\fi\fi}
  592. \def\smartitalic#1{{\sl #1}\futurelet\next\smartitalicx}
  593.  
  594. \let\i=\smartitalic
  595. \let\var=\smartitalic
  596. \let\dfn=\smartitalic
  597. \let\emph=\smartitalic
  598. \let\cite=\smartitalic
  599.  
  600. \def\b#1{{\bf #1}}
  601. \let\strong=\b
  602.  
  603. \def\t#1{{\tt \exhyphenpenalty=10000\rawbackslash \frenchspacing #1}\null}
  604. \let\ttfont = \t
  605. %\def\samp #1{`{\tt \rawbackslash \frenchspacing #1}'\null}
  606. \def\samp #1{`\tclose{#1}'\null}
  607. \def\key #1{{\tt \exhyphenpenalty=10000\uppercase{#1}}\null}
  608. \def\ctrl #1{{\tt \rawbackslash \hat}#1}
  609.  
  610. \let\file=\samp
  611.  
  612. % @code is a modification of @t,
  613. % which makes spaces the same size as normal in the surrounding text.
  614. \newdimen\tclosesave
  615. \newdimen\tcloserm
  616. \def\tclose#1{{\rm \tcloserm=\fontdimen2\font \tt \tclosesave=\fontdimen2\font
  617. \fontdimen2\font=\tcloserm
  618. % prevent breaking lines at hyphens.
  619. \exhyphenpenalty=10000
  620. \def\ {{\fontdimen2\font=\tclosesave{} }}%
  621.  \rawbackslash \frenchspacing #1\fontdimen2\font=\tclosesave}\null}
  622. \let\code=\tclose
  623. %\let\exp=\tclose  %Was temporary
  624.  
  625. % @kbd is like @code, except that if the argument is just one @key command, 
  626. % then @kbd has no effect.
  627.  
  628. \def\xkey{\key}
  629. \def\kbdfoo#1#2#3\par{\def\one{#1}\def\three{#3}\def\threex{??}%
  630. \ifx\one\xkey\ifx\threex\three \key{#2}%
  631. \else\tclose{\look}\fi
  632. \else\tclose{\look}\fi}
  633.  
  634. % Typeset a dimension, e.g., `in' or `pt'.  The only reason for the
  635. % argument is to make the input look right: @dmn{pt} instead of
  636. % @dmn{}pt.
  637. \def\dmn#1{\thinspace #1}
  638.  
  639. \def\kbd#1{\def\look{#1}\expandafter\kbdfoo\look??\par}
  640.  
  641. \def\l#1{{\li #1}\null}        % 
  642.  
  643. \def\r#1{{\rm #1}}        % roman font
  644. % Use of \lowercase was suggested.
  645. \def\sc#1{{\smallcaps#1}}    % smallcaps font
  646. \def\ii#1{{\it #1}}        % italic font
  647.  
  648. \message{page headings,}
  649.  
  650. \newskip\titlepagetopglue \titlepagetopglue = 1.5in
  651. \newskip\titlepagebottomglue \titlepagebottomglue = 2pc
  652.  
  653. % First the title page.  Must do @settitle before @titlepage.
  654. \def\titlefont#1{{\titlerm #1}}
  655.  
  656. \newtoks\realeverypar
  657. \newif\ifseenauthor
  658. \newif\iffinishedtitlepage
  659.  
  660. \def\titlepage{\begingroup \parindent=0pt \textfonts
  661.    \let\subtitlerm=\tenrm
  662. % I deinstalled the following change because \cmr12 is undefined.
  663. % This change was not in the ChangeLog anyway.  --rms.
  664. %   \let\subtitlerm=\cmr12
  665.    \def\subtitlefont{\subtitlerm \normalbaselineskip = 13pt \normalbaselines}%
  666.    %
  667.    \def\authorfont{\authorrm \normalbaselineskip = 16pt \normalbaselines}%
  668.    %
  669.    % Leave some space at the very top of the page.
  670.    \vglue\titlepagetopglue
  671.    %
  672.    % Now you can print the title using @title.
  673.    \def\title{\parsearg\titlezzz}%
  674.    \def\titlezzz##1{\leftline{\titlefont{##1}}
  675.             % print a rule at the page bottom also.
  676.             \finishedtitlepagefalse
  677.             \vskip4pt \hrule height 4pt \vskip4pt}%
  678.    % No rule at page bottom unless we print one at the top with @title.
  679.    \finishedtitlepagetrue
  680.    %
  681.    % Now you can put text using @subtitle.
  682.    \def\subtitle{\parsearg\subtitlezzz}%
  683.    \def\subtitlezzz##1{{\subtitlefont \rightline{##1}}}%
  684.    %
  685.    % @author should come last, but may come many times.
  686.    \def\author{\parsearg\authorzzz}%
  687.    \def\authorzzz##1{\ifseenauthor\else\vskip 0pt plus 1filll\seenauthortrue\fi
  688.       {\authorfont \leftline{##1}}}%
  689.    %  
  690.    % Most title ``pages'' are actually two pages long, with space
  691.    % at the top of the second.  We don't want the ragged left on the second.
  692.    \let\oldpage = \page
  693.    \def\page{%
  694.       \iffinishedtitlepage\else
  695.      \finishtitlepage
  696.       \fi
  697.       \oldpage
  698.       \let\page = \oldpage
  699.       \hbox{}}%
  700. %   \def\page{\oldpage \hbox{}}
  701. }
  702.  
  703. \def\Etitlepage{%
  704.    \iffinishedtitlepage\else
  705.       \finishtitlepage
  706.    \fi
  707.    % It is important to do the page break before ending the group,
  708.    % because the headline and footline are only empty inside the group.
  709.    % If we use the new definition of \page, we always get a blank page
  710.    % after the title page, which we certainly don't want.
  711.    \oldpage
  712.    \endgroup
  713.    \HEADINGSon
  714. }
  715.  
  716. \def\finishtitlepage{%
  717.    \vskip4pt \hrule height 2pt
  718.    \vskip\titlepagebottomglue
  719.    \finishedtitlepagetrue
  720. }
  721.  
  722. %%% Set up page headings and footings.
  723.  
  724. \let\thispage=\folio
  725.  
  726. \newtoks \evenheadline    % Token sequence for heading line of even pages
  727. \newtoks \oddheadline     % Token sequence for heading line of odd pages
  728. \newtoks \evenfootline    % Token sequence for footing line of even pages
  729. \newtoks \oddfootline     % Token sequence for footing line of odd pages
  730.  
  731. % Now make Tex use those variables
  732. \headline={{\textfonts\rm \ifodd\pageno \the\oddheadline
  733.                             \else \the\evenheadline \fi}}
  734. \footline={{\textfonts\rm \ifodd\pageno \the\oddfootline
  735.                             \else \the\evenfootline \fi}\HEADINGShook}
  736. \let\HEADINGShook=\relax
  737.  
  738. % Commands to set those variables.
  739. % For example, this is what  @headings on  does
  740. % @evenheading @thistitle|@thispage|@thischapter
  741. % @oddheading @thischapter|@thispage|@thistitle
  742. % @evenfooting @thisfile||
  743. % @oddfooting ||@thisfile
  744.  
  745. \def\evenheading{\parsearg\evenheadingxxx}
  746. \def\oddheading{\parsearg\oddheadingxxx}
  747. \def\everyheading{\parsearg\everyheadingxxx}
  748.  
  749. \def\evenfooting{\parsearg\evenfootingxxx}
  750. \def\oddfooting{\parsearg\oddfootingxxx}
  751. \def\everyfooting{\parsearg\everyfootingxxx}
  752.  
  753. {\catcode`\@=0 %
  754.  
  755. \gdef\evenheadingxxx #1{\evenheadingyyy #1@|@|@|@|\finish}
  756. \gdef\evenheadingyyy #1@|#2@|#3@|#4\finish{%
  757. \global\evenheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
  758.  
  759. \gdef\oddheadingxxx #1{\oddheadingyyy #1@|@|@|@|\finish}
  760. \gdef\oddheadingyyy #1@|#2@|#3@|#4\finish{%
  761. \global\oddheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
  762.  
  763. \gdef\everyheadingxxx #1{\everyheadingyyy #1@|@|@|@|\finish}
  764. \gdef\everyheadingyyy #1@|#2@|#3@|#4\finish{%
  765. \global\evenheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}
  766. \global\oddheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
  767.  
  768. \gdef\evenfootingxxx #1{\evenfootingyyy #1@|@|@|@|\finish}
  769. \gdef\evenfootingyyy #1@|#2@|#3@|#4\finish{%
  770. \global\evenfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
  771.  
  772. \gdef\oddfootingxxx #1{\oddfootingyyy #1@|@|@|@|\finish}
  773. \gdef\oddfootingyyy #1@|#2@|#3@|#4\finish{%
  774. \global\oddfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
  775.  
  776. \gdef\everyfootingxxx #1{\everyfootingyyy #1@|@|@|@|\finish}
  777. \gdef\everyfootingyyy #1@|#2@|#3@|#4\finish{%
  778. \global\evenfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}
  779. \global\oddfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}}
  780. %
  781. }% unbind the catcode of @.
  782.  
  783. % @headings double    turns headings on for double-sided printing.
  784. % @headings single    turns headings on for single-sided printing.
  785. % @headings off        turns them off.
  786. % @headings on        same as @headings double, retained for compatibility.
  787. % @headings after    turns on double-sided headings after this page.
  788. % @headings doubleafter    turns on double-sided headings after this page.
  789. % @headings singleafter turns on single-sided headings after this page.
  790. % By default, they are off.
  791.  
  792. \def\headings #1 {\csname HEADINGS#1\endcsname}
  793.  
  794. \def\HEADINGSoff{
  795. \global\evenheadline={\hfil} \global\evenfootline={\hfil}
  796. \global\oddheadline={\hfil} \global\oddfootline={\hfil}}
  797. \HEADINGSoff
  798. % When we turn headings on, set the page number to 1.
  799. % For double-sided printing, put current file name in lower left corner,
  800. % chapter name on inside top of right hand pages, document
  801. % title on inside top of left hand pages, and page numbers on outside top
  802. % edge of all pages.
  803. \def\HEADINGSdouble{
  804. %\pagealignmacro
  805. \global\pageno=1
  806. \global\evenfootline={\hfil}
  807. \global\oddfootline={\hfil}
  808. \global\evenheadline={\line{\folio\hfil\thistitle}}
  809. \global\oddheadline={\line{\thischapter\hfil\folio}}
  810. }
  811. % For single-sided printing, chapter title goes across top left of page,
  812. % page number on top right.
  813. \def\HEADINGSsingle{
  814. %\pagealignmacro
  815. \global\pageno=1
  816. \global\evenfootline={\hfil}
  817. \global\oddfootline={\hfil}
  818. \global\evenheadline={\line{\thischapter\hfil\folio}}
  819. \global\oddheadline={\line{\thischapter\hfil\folio}}
  820. }
  821. \def\HEADINGSon{\HEADINGSdouble}
  822.  
  823. \def\HEADINGSafter{\let\HEADINGShook=\HEADINGSdoublex}
  824. \let\HEADINGSdoubleafter=\HEADINGSafter
  825. \def\HEADINGSdoublex{%
  826. \global\evenfootline={\hfil}
  827. \global\oddfootline={\hfil}
  828. \global\evenheadline={\line{\folio\hfil\thistitle}}
  829. \global\oddheadline={\line{\thischapter\hfil\folio}}
  830. }
  831.  
  832. \def\HEADINGSsingleafter{\let\HEADINGShook=\HEADINGSsinglex}
  833. \def\HEADINGSsinglex{%
  834. \global\evenfootline={\hfil}
  835. \global\oddfootline={\hfil}
  836. \global\evenheadline={\line{\thischapter\hfil\folio}}
  837. \global\oddheadline={\line{\thischapter\hfil\folio}}
  838. }
  839.  
  840. % Subroutines used in generating headings
  841. % Produces Day Month Year style of output.
  842. \def\today{\number\day\space
  843. \ifcase\month\or
  844. January\or February\or March\or April\or May\or June\or
  845. July\or August\or September\or October\or November\or December\fi
  846. \space\number\year}
  847.  
  848. % Use this if you want the Month Day, Year style of output.
  849. %\def\today{\ifcase\month\or
  850. %January\or February\or March\or April\or May\or June\or
  851. %July\or August\or September\or October\or November\or December\fi
  852. %\space\number\day, \number\year}
  853.  
  854. % @settitle line...  specifies the title of the document, for headings
  855. % It generates no output of its own
  856.  
  857. \def\thistitle{No Title}
  858. \def\settitle{\parsearg\settitlezzz}
  859. \def\settitlezzz #1{\gdef\thistitle{#1}}
  860.  
  861. \message{tables,}
  862.  
  863. % @tabs -- simple alignment
  864.  
  865. % These don't work.  For one thing, \+ is defined as outer.
  866. % So these macros cannot even be defined.
  867.  
  868. %\def\tabs{\parsearg\tabszzz}
  869. %\def\tabszzz #1{\settabs\+#1\cr}
  870. %\def\tabline{\parsearg\tablinezzz}
  871. %\def\tablinezzz #1{\+#1\cr}
  872. %\def\&{&}
  873.  
  874. % Tables -- @table, @ftable, @item(x), @kitem(x), @xitem(x).
  875.  
  876. % default indentation of table text
  877. \newdimen\tableindent \tableindent=.8in
  878. % default indentation of @itemize and @enumerate text
  879. \newdimen\itemindent  \itemindent=.3in
  880. % margin between end of table item and start of table text.
  881. \newdimen\itemmargin  \itemmargin=.1in
  882.  
  883. % used internally for \itemindent minus \itemmargin
  884. \newdimen\itemmax
  885.  
  886. % Note @table and @ftable define @item, @itemx, etc., with these defs.
  887. % They also define \itemindex
  888. % to index the item name in whatever manner is desired (perhaps none).
  889.  
  890. \def\internalBitem{\smallbreak \parsearg\itemzzz}
  891. \def\internalBitemx{\par \parsearg\itemzzz}
  892.  
  893. \def\internalBxitem "#1"{\def\xitemsubtopix{#1} \smallbreak \parsearg\xitemzzz}
  894. \def\internalBxitemx "#1"{\def\xitemsubtopix{#1} \par \parsearg\xitemzzz}
  895.  
  896. \def\internalBkitem{\smallbreak \parsearg\kitemzzz}
  897. \def\internalBkitemx{\par \parsearg\kitemzzz}
  898.  
  899. \def\kitemzzz #1{\dosubind {kw}{\code{#1}}{for {\bf \lastfunction}}%
  900.                  \itemzzz {#1}}
  901.  
  902. \def\xitemzzz #1{\dosubind {kw}{\code{#1}}{for {\bf \xitemsubtopic}}%
  903.                  \itemzzz {#1}}
  904.  
  905. \def\itemzzz #1{\begingroup %
  906. \advance \hsize by -\rightskip %
  907. \advance \hsize by -\leftskip %
  908. \setbox0=\hbox{\itemfont{#1}}%
  909. \itemindex{#1}%
  910. \parskip=0in %
  911. \noindent %
  912. \ifdim \wd0>\itemmax %
  913. \vadjust{\penalty 10000}%
  914. \hbox to \hsize{\hskip -\tableindent\box0\hss}\ %
  915. \else %
  916. \hbox to 0pt{\hskip -\tableindent\box0\hss}%
  917. \fi %
  918. \endgroup %
  919. }
  920.  
  921. \def\item{\errmessage{@item while not in a table}}
  922. \def\itemx{\errmessage{@itemx while not in a table}}
  923. \def\kitem{\errmessage{@kitem while not in a table}}
  924. \def\kitemx{\errmessage{@kitemx while not in a table}}
  925. \def\xitem{\errmessage{@xitem while not in a table}}
  926. \def\xitemx{\errmessage{@xitemx while not in a table}}
  927.  
  928. %% Contains a kludge to get @end[description] to work
  929. \def\description{\tablez{\dontindex}{1}{}{}{}{}}
  930.  
  931. \def\table{\begingroup\inENV\obeylines\obeyspaces\tablex}
  932. {\obeylines\obeyspaces%
  933. \gdef\tablex #1^^M{%
  934. \tabley\dontindex#1        \endtabley}}
  935.  
  936. \def\ftable{\begingroup\inENV\obeylines\obeyspaces\ftablex}
  937. {\obeylines\obeyspaces%
  938. \gdef\ftablex #1^^M{%
  939. \tabley\fnitemindex#1        \endtabley
  940. \def\Eftable{\endgraf\endgroup\afterenvbreak}%
  941. \let\Etable=\relax}}
  942.  
  943. \def\dontindex #1{}
  944. \def\fnitemindex #1{\doind {fn}{\code{#1}}}%
  945.  
  946. {\obeyspaces %
  947. \gdef\tabley#1#2 #3 #4 #5 #6 #7\endtabley{\endgroup%
  948. \tablez{#1}{#2}{#3}{#4}{#5}{#6}}}
  949.  
  950. \def\tablez #1#2#3#4#5#6{%
  951. \aboveenvbreak %
  952. \begingroup %
  953. \def\Edescription{\Etable}% Neccessary kludge.
  954. \let\itemindex=#1%
  955. \ifnum 0#3>0 \advance \leftskip by #3\mil \fi %
  956. \ifnum 0#4>0 \tableindent=#4\mil \fi %
  957. \ifnum 0#5>0 \advance \rightskip by #5\mil \fi %
  958. \def\itemfont{#2}%
  959. \itemmax=\tableindent %
  960. \advance \itemmax by -\itemmargin %
  961. \advance \leftskip by \tableindent %
  962. \parindent = 0pt
  963. \parskip = \smallskipamount
  964. \ifdim \parskip=0pt \parskip=2pt \fi%
  965. \def\Etable{\endgraf\endgroup\afterenvbreak}%
  966. \let\item = \internalBitem %
  967. \let\itemx = \internalBitemx %
  968. \let\kitem = \internalBkitem %
  969. \let\kitemx = \internalBkitemx %
  970. \let\xitem = \internalBxitem %
  971. \let\xitemx = \internalBxitemx %
  972. }
  973.  
  974. % This is the counter used by @enumerate, which is really @itemize
  975.  
  976. \newcount \itemno
  977.  
  978. \def\itemize{\parsearg\itemizezzz}
  979.  
  980. \def\itemizezzz #1{\itemizey {#1}{\Eitemize}}
  981.  
  982. \def\itemizey #1#2{%
  983. \aboveenvbreak %
  984. \begingroup %
  985. \itemno = 0 %
  986. \itemmax=\itemindent %
  987. \advance \itemmax by -\itemmargin %
  988. \advance \leftskip by \itemindent %
  989. \parindent = 0pt
  990. \parskip = \smallskipamount
  991. \ifdim \parskip=0pt \parskip=2pt \fi%
  992. \def#2{\endgraf\endgroup\afterenvbreak}%
  993. \def\itemcontents{#1}%
  994. \let\item=\itemizeitem}
  995.  
  996. \def\bullet{$\ptexbullet$}
  997. \def\minus{$-$}
  998.  
  999. % Set sfcode to normal for the chars that usually have another value.
  1000. % These are `.?!:;,'
  1001. \def\frenchspacing{\sfcode46=1000 \sfcode63=1000 \sfcode33=1000
  1002.   \sfcode58=1000 \sfcode59=1000 \sfcode44=1000 }
  1003.  
  1004. \def\enumerate{\itemizey{\the\itemno.}\Eenumerate\flushcr}
  1005.  
  1006. \def\alphaenumerate{\itemizey{\ifcase\itemno\or
  1007. a\or b\or c\or d\or e\or f\or g\or h\or i\or j\or k\or l\or m\or n\or o\or
  1008. p\or q\or r\or s\or t\or u\or v\or w\or x\or y\or z\else
  1009. \errmessage{More than 26 items in @alphaenumerate; get a bigger alphabet.}\fi.}%
  1010. \Ealphaenumerate\flushcr}
  1011.  
  1012. \def\capsenumerate{\itemizey{\ifcase\itemno\or
  1013. A\or B\or C\or D\or E\or F\or G\or H\or I\or J\or K\or L\or M\or N\or O\or
  1014. P\or Q\or R\or S\or T\or U\or V\or W\or X\or Y\or Z\else
  1015. \errmessage{More than 26 items in @capsenumerate; get a bigger alphabet.}\fi.}%
  1016. \Ecapsenumerate\flushcr}
  1017.  
  1018. % Definition of @item while inside @itemize.
  1019.  
  1020. \def\itemizeitem{%
  1021. \advance\itemno by 1
  1022. {\let\par=\endgraf \smallbreak}%
  1023. \ifhmode \errmessage{\in hmode at itemizeitem}\fi
  1024. {\parskip=0in \hskip 0pt
  1025. \hbox to 0pt{\hss \itemcontents\hskip \itemmargin}%
  1026. \vadjust{\penalty 300}}%
  1027. \flushcr}
  1028.  
  1029. \message{indexing,}
  1030. % Index generation facilities
  1031.  
  1032. % Define \newwrite to be identical to plain tex's \newwrite
  1033. % except not \outer, so it can be used within \newindex.
  1034. {\catcode`\@=11
  1035. \gdef\newwrite{\alloc@7\write\chardef\sixt@@n}}
  1036.  
  1037. % \newindex {foo} defines an index named foo.
  1038. % It automatically defines \fooindex such that
  1039. % \fooindex ...rest of line... puts an entry in the index foo.
  1040. % It also defines \fooindfile to be the number of the output channel for
  1041. % the file that    accumulates this index.  The file's extension is foo.
  1042. % The name of an index should be no more than 2 characters long
  1043. % for the sake of vms.
  1044.  
  1045. \def\newindex #1{
  1046. \expandafter\newwrite \csname#1indfile\endcsname% Define number for output file
  1047. \openout \csname#1indfile\endcsname \jobname.#1    % Open the file
  1048. \expandafter\xdef\csname#1index\endcsname{%    % Define \xxxindex
  1049. \noexpand\doindex {#1}}
  1050. }
  1051.  
  1052. % @defindex foo  ==  \newindex{foo}
  1053.  
  1054. \def\defindex{\parsearg\newindex}
  1055.  
  1056. % Define @defcodeindex, like @defindex except put all entries in @code.
  1057.  
  1058. \def\newcodeindex #1{
  1059. \expandafter\newwrite \csname#1indfile\endcsname% Define number for output file
  1060. \openout \csname#1indfile\endcsname \jobname.#1    % Open the file
  1061. \expandafter\xdef\csname#1index\endcsname{%    % Define \xxxindex
  1062. \noexpand\docodeindex {#1}}
  1063. }
  1064.  
  1065. \def\defcodeindex{\parsearg\newcodeindex}
  1066.  
  1067. % @synindex foo bar    makes index foo feed into index bar.
  1068. % Do this instead of @defindex foo if you don't want it as a separate index.
  1069. \def\synindex #1 #2 {%
  1070. \expandafter\let\expandafter\synindexfoo\expandafter=\csname#2indfile\endcsname
  1071. \expandafter\let\csname#1indfile\endcsname=\synindexfoo
  1072. \expandafter\xdef\csname#1index\endcsname{%    % Define \xxxindex
  1073. \noexpand\doindex {#2}}%
  1074. }
  1075.  
  1076. % @syncodeindex foo bar   similar, but put all entries made for index foo
  1077. % inside @code.
  1078. \def\syncodeindex #1 #2 {%
  1079. \expandafter\let\expandafter\synindexfoo\expandafter=\csname#2indfile\endcsname
  1080. \expandafter\let\csname#1indfile\endcsname=\synindexfoo
  1081. \expandafter\xdef\csname#1index\endcsname{%    % Define \xxxindex
  1082. \noexpand\docodeindex {#2}}%
  1083. }
  1084.  
  1085. % Define \doindex, the driver for all \fooindex macros.
  1086. % Argument #1 is generated by the calling \fooindex macro,
  1087. %  and it is "foo", the name of the index.
  1088.  
  1089. % \doindex just uses \parsearg; it calls \doind for the actual work.
  1090. % This is because \doind is more useful to call from other macros.
  1091.  
  1092. % There is also \dosubind {index}{topic}{subtopic}
  1093. % which makes an entry in a two-level index such as the operation index.
  1094.  
  1095. \def\doindex#1{\edef\indexname{#1}\parsearg\singleindexer}
  1096. \def\singleindexer #1{\doind{\indexname}{#1}}
  1097.  
  1098. % like the previous two, but they put @code around the argument.
  1099. \def\docodeindex#1{\edef\indexname{#1}\parsearg\singlecodeindexer}
  1100. \def\singlecodeindexer #1{\doind{\indexname}{\code{#1}}}
  1101.  
  1102. \def\indexdummies{%
  1103. \def\_{{\realbackslash _}}%
  1104. \def\w{\realbackslash w }%
  1105. \def\bf{\realbackslash bf }%
  1106. \def\rm{\realbackslash rm }%
  1107. \def\sl{\realbackslash sl }%
  1108. \def\sf{\realbackslash sf}%
  1109. \def\tt{\realbackslash tt}%
  1110. \def\gtr{\realbackslash gtr}%
  1111. \def\less{\realbackslash less}%
  1112. \def\hat{\realbackslash hat}%
  1113. \def\char{\realbackslash char}%
  1114. \def\TeX{\realbackslash TeX}%
  1115. \def\dots{\realbackslash dots }%
  1116. \def\copyright{\realbackslash copyright }%
  1117. \def\tclose##1{\realbackslash tclose {##1}}%
  1118. \def\code##1{\realbackslash code {##1}}%
  1119. \def\samp##1{\realbackslash samp {##1}}%
  1120. \def\t##1{\realbackslash r {##1}}%
  1121. \def\r##1{\realbackslash r {##1}}%
  1122. \def\i##1{\realbackslash i {##1}}%
  1123. \def\b##1{\realbackslash b {##1}}%
  1124. \def\cite##1{\realbackslash cite {##1}}%
  1125. \def\key##1{\realbackslash key {##1}}%
  1126. \def\file##1{\realbackslash file {##1}}%
  1127. \def\var##1{\realbackslash var {##1}}%
  1128. \def\kbd##1{\realbackslash kbd {##1}}%
  1129. }
  1130.  
  1131. % \indexnofonts no-ops all font-change commands.
  1132. % This is used when outputting the strings to sort the index by.
  1133. \def\indexdummyfont#1{#1}
  1134. \def\indexdummytex{TeX}
  1135. \def\indexdummydots{...}
  1136.  
  1137. \def\indexnofonts{%
  1138. \let\w=\indexdummyfont
  1139. \let\t=\indexdummyfont
  1140. \let\r=\indexdummyfont
  1141. \let\i=\indexdummyfont
  1142. \let\b=\indexdummyfont
  1143. \let\emph=\indexdummyfont
  1144. \let\strong=\indexdummyfont
  1145. \let\cite=\indexdummyfont
  1146. \let\sc=\indexdummyfont
  1147. %Don't no-op \tt, since it isn't a user-level command
  1148. % and is used in the definitions of the active chars like <, >, |...
  1149. %\let\tt=\indexdummyfont
  1150. \let\tclose=\indexdummyfont
  1151. \let\code=\indexdummyfont
  1152. \let\file=\indexdummyfont
  1153. \let\samp=\indexdummyfont
  1154. \let\kbd=\indexdummyfont
  1155. \let\key=\indexdummyfont
  1156. \let\var=\indexdummyfont
  1157. \let\TeX=\indexdummytex
  1158. \let\dots=\indexdummydots
  1159. }
  1160.  
  1161. % To define \realbackslash, we must make \ not be an escape.
  1162. % We must first make another character (@) an escape
  1163. % so we do not become unable to do a definition.
  1164.  
  1165. {\catcode`\@=0 \catcode`\\=\other
  1166. @gdef@realbackslash{\}}
  1167.  
  1168. \let\indexbackslash=0  %overridden during \printindex.
  1169.  
  1170. \def\doind #1#2{%
  1171. {\count10=\lastpenalty %
  1172. {\indexdummies % Must do this here, since \bf, etc expand at this stage
  1173. \escapechar=`\\%
  1174. {\let\folio=0% Expand all macros now EXCEPT \folio
  1175. \def\rawbackslashxx{\indexbackslash}% \indexbackslash isn't defined now
  1176. % so it will be output as is; and it will print as backslash in the indx.
  1177. %
  1178. % Now process the index-string once, with all font commands turned off,
  1179. % to get the string to sort the index by.
  1180. {\indexnofonts
  1181. \xdef\temp1{#2}%
  1182. }%
  1183. % Now produce the complete index entry.  We process the index-string again,
  1184. % this time with font commands expanded, to get what to print in the index.
  1185. \edef\temp{%
  1186. \write \csname#1indfile\endcsname{%
  1187. \realbackslash entry {\temp1}{\folio}{#2}}}%
  1188. \temp }%
  1189. }\penalty\count10}}
  1190.  
  1191. \def\dosubind #1#2#3{%
  1192. {\count10=\lastpenalty %
  1193. {\indexdummies % Must do this here, since \bf, etc expand at this stage
  1194. \escapechar=`\\%
  1195. {\let\folio=0%
  1196. \def\rawbackslashxx{\indexbackslash}%
  1197. %
  1198. % Now process the index-string once, with all font commands turned off,
  1199. % to get the string to sort the index by.
  1200. {\indexnofonts
  1201. \xdef\temp1{#2 #3}%
  1202. }%
  1203. % Now produce the complete index entry.  We process the index-string again,
  1204. % this time with font commands expanded, to get what to print in the index.
  1205. \edef\temp{%
  1206. \write \csname#1indfile\endcsname{%
  1207. \realbackslash entry {\temp1}{\folio}{#2}{#3}}}%
  1208. \temp }%
  1209. }\penalty\count10}}
  1210.  
  1211. % The index entry written in the file actually looks like
  1212. %  \entry {sortstring}{page}{topic}
  1213. % or
  1214. %  \entry {sortstring}{page}{topic}{subtopic}
  1215. % The texindex program reads in these files and writes files
  1216. % containing these kinds of lines:
  1217. %  \initial {c}
  1218. %     before the first topic whose initial is c
  1219. %  \entry {topic}{pagelist}
  1220. %     for a topic that is used without subtopics
  1221. %  \primary {topic}
  1222. %     for the beginning of a topic that is used with subtopics
  1223. %  \secondary {subtopic}{pagelist}
  1224. %     for each subtopic.
  1225.  
  1226. % Define the user-accessible indexing commands 
  1227. % @findex, @vindex, @kindex, @cindex.
  1228.  
  1229. \def\findex {\fnindex}
  1230. \def\kindex {\kyindex}
  1231. \def\cindex {\cpindex}
  1232. \def\vindex {\vrindex}
  1233. \def\tindex {\tpindex}
  1234. \def\pindex {\pgindex}
  1235.  
  1236. \def\cindexsub {\begingroup\obeylines\cindexsub}
  1237. {\obeylines %
  1238. \gdef\cindexsub "#1" #2^^M{\endgroup %
  1239. \dosubind{cp}{#2}{#1}}}
  1240.  
  1241. % Define the macros used in formatting output of the sorted index material.
  1242.  
  1243. % This is what you call to cause a particular index to get printed.
  1244. % Write
  1245. % @unnumbered Function Index
  1246. % @printindex fn
  1247.  
  1248. \def\printindex{\parsearg\doprintindex}
  1249.  
  1250. \def\doprintindex#1{\tex %
  1251. \dobreak \chapheadingskip {10000}
  1252. \catcode`\%=\other\catcode`\&=\other\catcode`\#=\other
  1253. \catcode`\$=\other\catcode`\_=\other
  1254. \catcode`\~=\other
  1255. % The following don't help, since the chars were translated
  1256. % when the raw index was written, and their fonts were discarded
  1257. % due to \indexnofonts.
  1258. %\catcode`\"=\active
  1259. %\catcode`\^=\active
  1260. %\catcode`\_=\active
  1261. %\catcode`\|=\active
  1262. %\catcode`\<=\active
  1263. %\catcode`\>=\active
  1264. \def\indexbackslash{\rawbackslashxx}
  1265. \indexfonts\rm \tolerance=9500 \advance\baselineskip -1pt
  1266. \begindoublecolumns
  1267. \openin 1 \jobname.#1s
  1268. \ifeof 1 
  1269. % \enddoublecolumns gets confused if there is no text in the index,
  1270. % and it loses the chapter title and the aux file entries for the index.
  1271. % The easiest way to prevent this problem is to make sure there is some text.
  1272. (Index is empty)
  1273. \else \closein 1 \input \jobname.#1s
  1274. \fi
  1275. \enddoublecolumns
  1276. \Etex}
  1277.  
  1278. % These macros are used by the sorted index file itself.
  1279. % Change them to control the appearance of the index.
  1280.  
  1281. % Same as \bigskipamount except no shrink.
  1282. % \balancecolumns gets confused if there is any shrink.
  1283. \newskip\initialskipamount \initialskipamount 12pt plus4pt
  1284.  
  1285. \outer\def\initial #1{%
  1286. {\let\tentt=\sectt \let\tt=\sectt \let\sf=\sectt
  1287. \ifdim\lastskip<\initialskipamount
  1288. \removelastskip \penalty-200 \vskip \initialskipamount\fi
  1289. \line{\secbf#1\hfill}\kern 2pt\penalty10000}}
  1290.  
  1291. \outer\def\entry #1#2{
  1292. {\parfillskip=0in \parskip=0in \parindent=0in
  1293. \hangindent=1in \hangafter=1%
  1294. \noindent\hbox{#1}\indexdotfill #2\par
  1295. }}
  1296.  
  1297. % Like \dotfill except takes at least 1 em.
  1298. \def\indexdotfill{\cleaders
  1299.   \hbox{$\mathsurround=0pt \mkern1.5mu . \mkern1.5mu$}\hskip 1em plus 1fill}
  1300.  
  1301. \def\primary #1{\line{#1\hfil}}
  1302.  
  1303. \newskip\secondaryindent \secondaryindent=0.5cm
  1304.  
  1305. \def\secondary #1#2{
  1306. {\parfillskip=0in \parskip=0in
  1307. \hangindent =1in \hangafter=1
  1308. \noindent\hskip\secondaryindent\hbox{#1}\indexdotfill #2\par
  1309. }}
  1310.  
  1311. %% Define two-column mode, which is used in indexes.
  1312. %% Adapted from the TeXBook, page 416
  1313. \catcode `\@=11
  1314.  
  1315. \newbox\partialpage
  1316.  
  1317. \newdimen\doublecolumnhsize  \doublecolumnhsize = 3.11in
  1318. \newdimen\doublecolumnvsize  \doublecolumnvsize = 19.1in
  1319. \newdimen\availdimen@
  1320.  
  1321. \def\begindoublecolumns{\begingroup
  1322.   \output={\global\setbox\partialpage=
  1323.     \vbox{\unvbox255\kern -\topskip \kern \baselineskip}}\eject
  1324.   \output={\doublecolumnout}%
  1325.   \hsize=\doublecolumnhsize \vsize=\doublecolumnvsize}
  1326. \def\enddoublecolumns{\output={\balancecolumns}\eject
  1327.   \endgroup \pagegoal=\vsize}
  1328.  
  1329. \def\doublecolumnout{\splittopskip=\topskip \splitmaxdepth=\maxdepth
  1330.   \dimen@=\pageheight \advance\dimen@ by-\ht\partialpage
  1331.   \setbox0=\vsplit255 to\dimen@ \setbox2=\vsplit255 to\dimen@
  1332.   \onepageout\pagesofar \unvbox255 \penalty\outputpenalty}
  1333. \def\pagesofar{\unvbox\partialpage %
  1334.   \hsize=\doublecolumnhsize % have to restore this since output routine
  1335. %          changes it to set cropmarks (P. A. MacKay, 12 Nov. 1986)
  1336.   \wd0=\hsize \wd2=\hsize \hbox to\pagewidth{\box0\hfil\box2}}
  1337. \def\balancecolumns{%
  1338. % Unset the glue.
  1339.   \setbox255=\vbox{\unvbox255}
  1340.   \dimen@=\ht255
  1341.   \advance\dimen@ by\topskip \advance\dimen@ by-\baselineskip
  1342.   \divide\dimen@ by2
  1343.   \availdimen@=\pageheight \advance\availdimen@ by-\ht\partialpage
  1344. % If the remaining data is too big for one page,
  1345. % output one page normally, then work with what remains.
  1346.   \ifdim \dimen@>\availdimen@
  1347.    {
  1348.      \splittopskip=\topskip \splitmaxdepth=\maxdepth
  1349.      \dimen@=\pageheight \advance\dimen@ by-\ht\partialpage
  1350.      \setbox0=\vsplit255 to\dimen@ \setbox2=\vsplit255 to\dimen@
  1351.      \onepageout\pagesofar
  1352.    }
  1353. % Recompute size of what remains, in case we just output some of it.
  1354.   \dimen@=\ht255
  1355.   \advance\dimen@ by\topskip \advance\dimen@ by-\baselineskip
  1356.   \divide\dimen@ by2
  1357.   \fi
  1358.   \setbox0=\vbox{\unvbox255}
  1359.   \splittopskip=\topskip
  1360.   {\vbadness=10000 \loop \global\setbox3=\copy0
  1361.     \global\setbox1=\vsplit3 to\dimen@
  1362.     \ifdim\ht3>\dimen@ \global\advance\dimen@ by1pt \repeat}
  1363.   \setbox0=\vbox to\dimen@{\unvbox1}  \setbox2=\vbox to\dimen@{\unvbox3}
  1364.   \pagesofar}
  1365.  
  1366. \catcode `\@=\other
  1367. \message{sectioning,}
  1368. % Define chapters, sections, etc.
  1369.  
  1370. \newcount \chapno
  1371. \newcount \secno
  1372. \newcount \subsecno
  1373. \newcount \subsubsecno
  1374.  
  1375. % This counter is funny since it counts through charcodes of letters A, B, ...
  1376. \newcount \appendixno  \appendixno = `\@
  1377. \def\appendixletter{\char\the\appendixno}
  1378.  
  1379. \newwrite \contentsfile
  1380. % This is called from \setfilename.
  1381. \def\opencontents{\openout \contentsfile = \jobname.toc}
  1382.  
  1383. % Each @chapter defines this as the name of the chapter.
  1384. % page headings and footings can use it.  @section does likewise
  1385.  
  1386. \def\thischapter{} \def\thissection{}
  1387. \def\seccheck#1{\if \pageno<0 %
  1388. \errmessage{@#1 not allowed after generating table of contents}\fi
  1389. %
  1390. }
  1391.  
  1392. \def\chapternofonts{%
  1393. \let\rawbackslash=\relax%
  1394. \let\frenchspacing=\relax%
  1395. \def\TeX{\realbackslash TeX}
  1396. \def\dots{\realbackslash dots}
  1397. \def\copyright{\realbackslash copyright}
  1398. \def\tt{\realbackslash tt}
  1399. \def\bf{\realbackslash bf }
  1400. \def\w{\realbackslash w}
  1401. \def\less{\realbackslash less}
  1402. \def\gtr{\realbackslash gtr}
  1403. \def\hat{\realbackslash hat}
  1404. \def\char{\realbackslash char}
  1405. \def\tclose##1{\realbackslash tclose {##1}}
  1406. \def\code##1{\realbackslash code {##1}}
  1407. \def\samp##1{\realbackslash samp {##1}}
  1408. \def\r##1{\realbackslash r {##1}}
  1409. \def\b##1{\realbackslash b {##1}}
  1410. \def\key##1{\realbackslash key {##1}}
  1411. \def\file##1{\realbackslash file {##1}}
  1412. \def\kbd##1{\realbackslash kbd {##1}}
  1413. % These are redefined because @smartitalic wouldn't work inside xdef.
  1414. \def\i##1{\realbackslash i {##1}}
  1415. \def\cite##1{\realbackslash cite {##1}}
  1416. \def\var##1{\realbackslash var {##1}}
  1417. \def\emph##1{\realbackslash emph {##1}}
  1418. \def\dfn##1{\realbackslash dfn {##1}}
  1419. }
  1420.  
  1421. \outer\def\chapter{\parsearg\chapterzzz}
  1422. \def\chapterzzz #1{\seccheck{chapter}%
  1423. \secno=0 \subsecno=0 \subsubsecno=0
  1424. \global\advance \chapno by 1 \message{Chapter \the\chapno}%
  1425. \chapmacro {#1}{\the\chapno}%
  1426. \gdef\thissection{#1}%
  1427. \gdef\thischaptername{#1}%
  1428. % We don't substitute the actual chapter name into \thischapter
  1429. % because we don't want its macros evaluated now.
  1430. \xdef\thischapter{Chapter \the\chapno: \noexpand\thischaptername}%
  1431. {\chapternofonts%
  1432. \edef\temp{{\realbackslash chapentry {#1}{\the\chapno}{\noexpand\folio}}}%
  1433. \escapechar=`\\%
  1434. \write \contentsfile \temp  %
  1435. \donoderef %
  1436. }}
  1437.  
  1438. \outer\def\appendix{\parsearg\appendixzzz}
  1439. \def\appendixzzz #1{\seccheck{appendix}%
  1440. \secno=0 \subsecno=0 \subsubsecno=0
  1441. \global\advance \appendixno by 1 \message{Appendix \appendixletter}%
  1442. \chapmacro {#1}{Appendix \appendixletter}%
  1443. \gdef\thissection{#1}%
  1444. \gdef\thischaptername{#1}%
  1445. \xdef\thischapter{Appendix \appendixletter: \noexpand\thischaptername}%
  1446. {\chapternofonts%
  1447. \edef\temp{{\realbackslash chapentry 
  1448.   {#1}{Appendix \appendixletter}{\noexpand\folio}}}%
  1449. \escapechar=`\\%
  1450. \write \contentsfile \temp  %
  1451. \appendixnoderef %
  1452. }}
  1453.  
  1454. \outer\def\top{\parsearg\unnumberedzzz}
  1455. \outer\def\unnumbered{\parsearg\unnumberedzzz}
  1456. \def\unnumberedzzz #1{\seccheck{unnumbered}%
  1457. \secno=0 \subsecno=0 \subsubsecno=0 \message{(#1)}
  1458. \unnumbchapmacro {#1}%
  1459. \gdef\thischapter{#1}\gdef\thissection{#1}%
  1460. {\chapternofonts%
  1461. \edef\temp{{\realbackslash unnumbchapentry {#1}{\noexpand\folio}}}%
  1462. \escapechar=`\\%
  1463. \write \contentsfile \temp  %
  1464. \unnumbnoderef %
  1465. }}
  1466.  
  1467. \outer\def\section{\parsearg\sectionzzz}
  1468. \def\sectionzzz #1{\seccheck{section}%
  1469. \subsecno=0 \subsubsecno=0 \global\advance \secno by 1 %
  1470. \gdef\thissection{#1}\secheading {#1}{\the\chapno}{\the\secno}%
  1471. {\chapternofonts%
  1472. \edef\temp{{\realbackslash secentry %
  1473. {#1}{\the\chapno}{\the\secno}{\noexpand\folio}}}%
  1474. \escapechar=`\\%
  1475. \write \contentsfile \temp %
  1476. \donoderef %
  1477. \penalty 10000 %
  1478. }}
  1479.  
  1480. \outer\def\appendixsection{\parsearg\appendixsectionzzz}
  1481. \outer\def\appendixsec{\parsearg\appendixsectionzzz}
  1482. \def\appendixsectionzzz #1{\seccheck{appendixsection}%
  1483. \subsecno=0 \subsubsecno=0 \global\advance \secno by 1 %
  1484. \gdef\thissection{#1}\secheading {#1}{\appendixletter}{\the\secno}%
  1485. {\chapternofonts%
  1486. \edef\temp{{\realbackslash secentry %
  1487. {#1}{\appendixletter}{\the\secno}{\noexpand\folio}}}%
  1488. \escapechar=`\\%
  1489. \write \contentsfile \temp %
  1490. \appendixnoderef %
  1491. \penalty 10000 %
  1492. }}
  1493.  
  1494. \outer\def\unnumberedsec{\parsearg\unnumberedseczzz}
  1495. \def\unnumberedseczzz #1{\seccheck{unnumberedsec}%
  1496. \plainsecheading {#1}\gdef\thissection{#1}%
  1497. {\chapternofonts%
  1498. \edef\temp{{\realbackslash unnumbsecentry{#1}{\noexpand\folio}}}%
  1499. \escapechar=`\\%
  1500. \write \contentsfile \temp %
  1501. \unnumbnoderef %
  1502. \penalty 10000 %
  1503. }}
  1504.  
  1505. \outer\def\subsection{\parsearg\subsectionzzz}
  1506. \def\subsectionzzz #1{\seccheck{subsection}%
  1507. \gdef\thissection{#1}\subsubsecno=0 \global\advance \subsecno by 1 %
  1508. \subsecheading {#1}{\the\chapno}{\the\secno}{\the\subsecno}%
  1509. {\chapternofonts%
  1510. \edef\temp{{\realbackslash subsecentry %
  1511. {#1}{\the\chapno}{\the\secno}{\the\subsecno}{\noexpand\folio}}}%
  1512. \escapechar=`\\%
  1513. \write \contentsfile \temp %
  1514. \donoderef %
  1515. \penalty 10000 %
  1516. }}
  1517.  
  1518. \outer\def\appendixsubsec{\parsearg\appendixsubseczzz}
  1519. \def\appendixsubseczzz #1{\seccheck{appendixsubsec}%
  1520. \gdef\thissection{#1}\subsubsecno=0 \global\advance \subsecno by 1 %
  1521. \subsecheading {#1}{\appendixletter}{\the\secno}{\the\subsecno}%
  1522. {\chapternofonts%
  1523. \edef\temp{{\realbackslash subsecentry %
  1524. {#1}{\appendixletter}{\the\secno}{\the\subsecno}{\noexpand\folio}}}%
  1525. \escapechar=`\\%
  1526. \write \contentsfile \temp %
  1527. \appendixnoderef %
  1528. \penalty 10000 %
  1529. }}
  1530.  
  1531. \outer\def\unnumberedsubsec{\parsearg\unnumberedsubseczzz}
  1532. \def\unnumberedsubseczzz #1{\seccheck{unnumberedsubsec}%
  1533. \plainsecheading {#1}\gdef\thissection{#1}%
  1534. {\chapternofonts%
  1535. \edef\temp{{\realbackslash unnumbsubsecentry{#1}{\noexpand\folio}}}%
  1536. \escapechar=`\\%
  1537. \write \contentsfile \temp %
  1538. \unnumbnoderef %
  1539. \penalty 10000 %
  1540. }}
  1541.  
  1542. \outer\def\subsubsection{\parsearg\subsubsectionzzz}
  1543. \def\subsubsectionzzz #1{\seccheck{subsubsection}%
  1544. \gdef\thissection{#1}\global\advance \subsubsecno by 1 %
  1545. \subsubsecheading {#1}
  1546.   {\the\chapno}{\the\secno}{\the\subsecno}{\the\subsubsecno}%
  1547. {\chapternofonts%
  1548. \edef\temp{{\realbackslash subsubsecentry %
  1549.   {#1}
  1550.   {\the\chapno}{\the\secno}{\the\subsecno}{\the\subsubsecno}
  1551.   {\noexpand\folio}}}%
  1552. \escapechar=`\\%
  1553. \write \contentsfile \temp %
  1554. \donoderef %
  1555. \penalty 10000 %
  1556. }}
  1557.  
  1558. \outer\def\appendixsubsubsec{\parsearg\appendixsubsubseczzz}
  1559. \def\appendixsubsubseczzz #1{\seccheck{appendixsubsubsec}%
  1560. \gdef\thissection{#1}\global\advance \subsubsecno by 1 %
  1561. \subsubsecheading {#1}
  1562.   {\appendixletter}{\the\secno}{\the\subsecno}{\the\subsubsecno}%
  1563. {\chapternofonts%
  1564. \edef\temp{{\realbackslash subsubsecentry{#1}%
  1565.   {\appendixletter}
  1566.   {\the\secno}{\the\subsecno}{\the\subsubsecno}{\noexpand\folio}}}%
  1567. \escapechar=`\\%
  1568. \write \contentsfile \temp %
  1569. \appendixnoderef %
  1570. \penalty 10000 %
  1571. }}
  1572.  
  1573. \outer\def\unnumberedsubsubsec{\parsearg\unnumberedsubsubseczzz}
  1574. \def\unnumberedsubsubseczzz #1{\seccheck{unnumberedsubsubsec}%
  1575. \plainsecheading {#1}\gdef\thissection{#1}%
  1576. {\chapternofonts%
  1577. \edef\temp{{\realbackslash unnumbsubsubsecentry{#1}{\noexpand\folio}}}%
  1578. \escapechar=`\\%
  1579. \write \contentsfile \temp %
  1580. \unnumbnoderef %
  1581. \penalty 10000 %
  1582. }}
  1583.  
  1584. % These are variants which are not "outer", so they can appear in @ifinfo.
  1585. \def\infotop{\parsearg\unnumberedzzz}
  1586. \def\infounnumbered{\parsearg\unnumberedzzz}
  1587. \def\infounnumberedsec{\parsearg\unnumberedseczzz}
  1588. \def\infounnumberedsubsec{\parsearg\unnumberedsubseczzz}
  1589. \def\infounnumberedsubsubsec{\parsearg\unnumberedsubsubseczzz}
  1590.  
  1591. \def\infoappendix{\parsearg\appendixzzz}
  1592. \def\infoappendixsec{\parsearg\appendixseczzz}
  1593. \def\infoappendixsubsec{\parsearg\appendixsubseczzz}
  1594. \def\infoappendixsubsubsec{\parsearg\appendixsubsubseczzz}
  1595.  
  1596. \def\infochapter{\parsearg\chapterzzz}
  1597. \def\infosection{\parsearg\sectionzzz}
  1598. \def\infosubsection{\parsearg\subsectionzzz}
  1599. \def\infosubsubsection{\parsearg\subsubsectionzzz}
  1600.  
  1601. % Define @majorheading, @heading and @subheading
  1602.  
  1603. \def\majorheading{\parsearg\majorheadingzzz}
  1604. \def\majorheadingzzz #1{%
  1605. {\advance\chapheadingskip by 10pt \chapbreak }%
  1606. {\chapfonts \line{\rm #1\hfill}}\bigskip \par\penalty 200}
  1607.  
  1608. \def\chapheading{\parsearg\chapheadingzzz}
  1609. \def\chapheadingzzz #1{\chapbreak %
  1610. {\chapfonts \line{\rm #1\hfill}}\bigskip \par\penalty 200}
  1611.  
  1612. \def\heading{\parsearg\secheadingi}
  1613.  
  1614. \def\subheading{\parsearg\subsecheadingi}
  1615.  
  1616. \def\subsubheading{\parsearg\subsubsecheadingi}
  1617.  
  1618. % These macros generate a chapter, section, etc. heading only
  1619. % (including whitespace, linebreaking, etc. around it),
  1620. % given all the information in convenient, parsed form.
  1621.  
  1622. %%% Args are the skip and penalty (usually negative)
  1623. \def\dobreak#1#2{\par\ifdim\lastskip<#1\removelastskip\penalty#2\vskip#1\fi}
  1624.  
  1625. \def\setchapterstyle #1 {\csname CHAPF#1\endcsname}
  1626.  
  1627. %%% Define plain chapter starts, and page on/off switching for it
  1628. % Parameter controlling skip before chapter headings (if needed)
  1629.  
  1630. \newskip \chapheadingskip \chapheadingskip = 30pt plus 8pt minus 4pt
  1631.  
  1632. \def\chapbreak{\dobreak \chapheadingskip {-4000}}
  1633. \def\chappager{\par\vfill\supereject}
  1634. \def\chapoddpage{\chappager \ifodd\pageno \else \hbox to 0pt{} \chappager\fi}
  1635.  
  1636. \def\setchapternewpage #1 {\csname CHAPPAG#1\endcsname}
  1637.  
  1638. \def\CHAPPAGoff{
  1639. \global\let\pchapsepmacro=\chapbreak
  1640. \global\let\pagealignmacro=\chappager}
  1641.  
  1642. \def\CHAPPAGon{
  1643. \global\let\pchapsepmacro=\chappager
  1644. \global\let\pagealignmacro=\chappager
  1645. \global\def\HEADINGSon{\HEADINGSsingle}}
  1646.  
  1647. \def\CHAPPAGodd{
  1648. \global\let\pchapsepmacro=\chapoddpage
  1649. \global\let\pagealignmacro=\chapoddpage
  1650. \global\def\HEADINGSon{\HEADINGSdouble}}
  1651.  
  1652. \CHAPPAGon
  1653.  
  1654. \def\CHAPFplain{
  1655. \global\let\chapmacro=\chfplain
  1656. \global\let\unnumbchapmacro=\unnchfplain}
  1657.  
  1658. \def\chfplain #1#2{%
  1659.   \pchapsepmacro
  1660.   {%
  1661.     \chapfonts
  1662.     \leftline{\rm #2\enspace #1}%
  1663.   }%
  1664.   \bigskip
  1665.   \penalty5000
  1666. }
  1667.  
  1668. \def\unnchfplain #1{%
  1669. \pchapsepmacro %
  1670. {\chapfonts \line{\rm #1\hfill}}\bigskip \par\penalty 10000 %
  1671. }
  1672. \CHAPFplain % The default
  1673.  
  1674. \def\unnchfopen #1{%
  1675. \chapoddpage {\chapfonts \line{\rm #1\hfill}}\bigskip \par\penalty 10000 %
  1676. }
  1677.  
  1678. \def\chfopen #1#2{\chapoddpage {\chapfonts
  1679. \vbox to 3in{\vfil \hbox to\hsize{\hfil #2} \hbox to\hsize{\hfil #1} \vfil}}%
  1680. \par\penalty 5000 %
  1681. }
  1682.  
  1683. \def\CHAPFopen{
  1684. \global\let\chapmacro=\chfopen
  1685. \global\let\unnumbchapmacro=\unnchfopen}
  1686.  
  1687. % Parameter controlling skip before section headings.
  1688.  
  1689. \newskip \subsecheadingskip  \subsecheadingskip = 17pt plus 8pt minus 4pt
  1690. \def\subsecheadingbreak{\dobreak \subsecheadingskip {-500}}
  1691.  
  1692. \newskip \secheadingskip  \secheadingskip = 21pt plus 8pt minus 4pt
  1693. \def\secheadingbreak{\dobreak \secheadingskip {-1000}}
  1694.  
  1695.  
  1696. % Section fonts are the base font at magstep2, which produces
  1697. % a size a bit more than 14 points in the default situation.    
  1698.  
  1699. \def\secheading #1#2#3{\secheadingi {#2.#3\enspace #1}}
  1700. \def\plainsecheading #1{\secheadingi {#1}}
  1701. \def\secheadingi #1{{\advance \secheadingskip by \parskip %
  1702. \secheadingbreak}%
  1703. {\secfonts \line{\rm #1\hfill}}%
  1704. \ifdim \parskip<10pt \kern 10pt\kern -\parskip\fi \penalty 10000 }
  1705.  
  1706.  
  1707. % Subsection fonts are the base font at magstep1, 
  1708. % which produces a size of 12 points.
  1709.  
  1710. \def\subsecheading #1#2#3#4{\subsecheadingi {#2.#3.#4\enspace #1}}
  1711. \def\subsecheadingi #1{{\advance \subsecheadingskip by \parskip %
  1712. \subsecheadingbreak}%
  1713. {\subsecfonts \line{\rm #1\hfill}}%
  1714. \ifdim \parskip<10pt \kern 10pt\kern -\parskip\fi \penalty 10000 }
  1715.  
  1716. \def\subsubsecfonts{\subsecfonts} % Maybe this should change:
  1717.                   % Perhaps make sssec fonts scaled
  1718.                   % magstep half
  1719. \def\subsubsecheading #1#2#3#4#5{\subsubsecheadingi {#2.#3.#4.#5\enspace #1}}
  1720. \def\subsubsecheadingi #1{{\advance \subsecheadingskip by \parskip %
  1721. \subsecheadingbreak}%
  1722. {\subsubsecfonts \line{\rm #1\hfill}}%
  1723. \ifdim \parskip<10pt \kern 10pt\kern -\parskip\fi \penalty 10000}
  1724.  
  1725.  
  1726. \message{toc printing,}
  1727.  
  1728. % Finish up the main text and prepare to read what we've written
  1729. % to \contentsfile.
  1730.  
  1731. \def\startcontents#1{%
  1732.    \ifnum \pageno>0
  1733.       \pagealignmacro
  1734.       \immediate\closeout \contentsfile
  1735.       \pageno = -1        % Request roman numbered pages.
  1736.    \fi
  1737.    % Don't need to put `Contents' or `Short Contents' in the headline. 
  1738.    % It is abundantly clear what they are.
  1739.    \unnumbchapmacro{#1}\def\thischapter{}%
  1740.    \begingroup           % Set up to handle contents files properly.
  1741.       \catcode`\\=0  \catcode`\{=1  \catcode`\}=2  \catcode`\@=11
  1742.       \raggedbottom             % Worry more about breakpoints than the bottom.
  1743.       \advance\hsize by -1in    % Don't use the full line length.
  1744. }
  1745.  
  1746.   
  1747. % Normal (long) toc.
  1748. \outer\def\contents{%
  1749.    \startcontents{Table of Contents}%
  1750.       \input \jobname.toc
  1751.    \endgroup
  1752.    \vfill \eject
  1753. }
  1754.  
  1755. % And just the chapters.
  1756. \outer\def\summarycontents{%
  1757.    \startcontents{Short Contents}%
  1758.       %
  1759.       \let\chapentry = \shortchapentry
  1760.       \let\unnumbchapentry = \shortunnumberedentry
  1761.       % We want a true roman here for the page numbers.
  1762.       \secfonts
  1763.       \let\rm=\shortcontrm \let\bf=\shortcontbf \let\sl=\shortcontsl
  1764.       \rm
  1765.       \advance\baselineskip by 1pt % Open it up a little.
  1766.       \def\secentry ##1##2##3##4{}
  1767.       \def\unnumbsecentry ##1##2{}
  1768.       \def\subsecentry ##1##2##3##4##5{}
  1769.       \def\unnumbsubsecentry ##1##2{}
  1770.       \def\subsubsecentry ##1##2##3##4##5##6{}
  1771.       \def\unnumbsubsubsecentry ##1##2{}
  1772.       \input \jobname.toc
  1773.    \endgroup
  1774.    \vfill \eject
  1775. }
  1776. \let\shortcontents = \summarycontents
  1777.  
  1778. % These macros generate individual entries in the table of contents.
  1779. % The first argument is the chapter or section name.
  1780. % The last argument is the page number.
  1781. % The arguments in between are the chapter number, section number, ...
  1782.  
  1783. % Chapter-level things, for both the long and short contents.
  1784. \def\chapentry#1#2#3{\dochapentry{#2\labelspace#1}{#3}}
  1785. \def\shortchapentry#1#2#3{%
  1786.    \line{{#2\labelspace #1}\dotfill\doshortpageno{#3}}%
  1787. }
  1788.  
  1789. \def\unnumbchapentry#1#2{\dochapentry{#1}{#2}}
  1790. \def\shortunnumberedentry#1#2{%
  1791.    \line{#1\dotfill\doshortpageno{#2}}%
  1792. }
  1793.  
  1794. % Sections.
  1795. \def\secentry#1#2#3#4{\dosecentry{#2.#3\labelspace#1}{#4}}
  1796. \def\unnumbsecentry#1#2{\dosecentry{#1}{#2}}
  1797.  
  1798. % Subsections.
  1799. \def\subsecentry#1#2#3#4#5{\dosubsecentry{#2.#3.#4\labelspace#1}{#5}}
  1800. \def\unnumbsubsecentry#1#2{\dosubsecentry{#1}{#2}}
  1801.  
  1802. % And subsubsections.
  1803. \def\subsubsecentry#1#2#3#4#5#6{%
  1804.   \dosubsubsecentry{#2.#3.#4.#5\labelspace#1}{#6}}
  1805. \def\unnumbsubsubsecentry#1#2{\dosubsubsecentry{#1}{#2}}
  1806.  
  1807.  
  1808. % This parameter controls the indentation of the various levels.
  1809. \newdimen\tocindent \tocindent = 3pc
  1810.  
  1811. % Now for the actual typesetting. In all these, #1 is the text and #2 is the 
  1812. % page number.
  1813. %
  1814. % If the toc has to be broken over pages, we would want to be at chapters 
  1815. % if at all possible; hence the \penalty.
  1816. \def\dochapentry#1#2{%
  1817.    \penalty-300 \vskip\baselineskip
  1818.    \line{\chapentryfonts #1\dotfill \dopageno{#2}}%
  1819.    \nobreak\vskip .25\baselineskip
  1820. }
  1821.  
  1822. \def\dosecentry#1#2{%
  1823.    \line{\secentryfonts \hskip\tocindent #1\dotfill \dopageno{#2}}%
  1824. }
  1825.  
  1826. \def\dosubsecentry#1#2{%
  1827.    \line{\subsecentryfonts \hskip2\tocindent #1\dotfill \dopageno{#2}}%
  1828. }
  1829.  
  1830. \def\dosubsubsecentry#1#2{%
  1831.    \line{\subsubsecentryfonts \hskip3\tocindent #1\dotfill \dopageno{#2}}%
  1832. }
  1833.  
  1834. % Space between chapter (or whatever) number and the title.
  1835. \def\labelspace{\hskip1em \relax}
  1836.  
  1837. \def\dopageno#1{{\rm #1}}
  1838. \def\doshortpageno#1{{\rm #1}}
  1839.  
  1840. \def\chapentryfonts{\secfonts \rm}
  1841. \def\secentryfonts{\textfonts}
  1842. \let\subsecentryfonts = \textfonts
  1843. \let\subsubsecentryfonts = \textfonts
  1844.  
  1845.  
  1846. \message{environments,}
  1847.  
  1848. % Since these characters are used in examples, it should be an even number of 
  1849. % \tt widths. Each \tt character is 1en, so two makes it 1em.
  1850. % Furthermore, these definitions must come after we define our fonts.
  1851. \newbox\dblarrowbox    \newbox\longdblarrowbox
  1852. \newbox\pushcharbox    \newbox\bullbox
  1853. \newbox\equivbox       \newbox\errorbox
  1854.  
  1855. \let\ptexequiv = \equiv
  1856.  
  1857. {\tentt
  1858. \global\setbox\dblarrowbox = \hbox to 1em{\hfil$\Rightarrow$\hfil}
  1859. \global\setbox\longdblarrowbox = \hbox to 1em{\hfil$\mapsto$\hfil}
  1860. \global\setbox\pushcharbox = \hbox to 1em{\hfil$\dashv$\hfil}
  1861. \global\setbox\equivbox = \hbox to 1em{\hfil$\ptexequiv$\hfil}
  1862. % Adapted from the manmac format (p.420 of TeXbook)
  1863. \global\setbox\bullbox = \hbox to 1em{\kern.15em\vrule height .75ex width .85ex
  1864.                                       depth .1ex\hfil}
  1865. }
  1866.  
  1867. \def\point{$\star$}
  1868.  
  1869. \def\result{\leavevmode\raise.15ex\copy\dblarrowbox}
  1870. \def\expansion{\leavevmode\raise.1ex\copy\longdblarrowbox}
  1871. \def\print{\leavevmode\lower.1ex\copy\pushcharbox}
  1872.  
  1873. \def\equiv{\leavevmode\lower.1ex\copy\equivbox}
  1874.  
  1875. % Does anyone really want this?
  1876. % \def\bull{\leavevmode\copy\bullbox}
  1877.  
  1878. % Adapted from the TeXbook's \boxit.
  1879. {\tentt \global\dimen0 = 3em}% Width of the box.
  1880. \dimen2 = .55pt % Thickness of rules
  1881. % The text. (`r' is open on the right, `e' somewhat less so on the left.)
  1882. \setbox0 = \hbox{\kern-.75pt \tensf error\kern-1.5pt}
  1883.  
  1884. \global\setbox\errorbox=\hbox to \dimen0{\hfil
  1885.    \hsize = \dimen0 \advance\hsize by -5.8pt % Space to left+right.
  1886.    \advance\hsize by -2\dimen2 % Rules.
  1887.    \vbox{
  1888.       \hrule height\dimen2
  1889.       \hbox{\vrule width\dimen2 \kern3pt          % Space to left of text.
  1890.          \vtop{\kern2.4pt \box0 \kern2.4pt}% Space above/below.
  1891.          \kern3pt\vrule width\dimen2}% Space to right.
  1892.       \hrule height\dimen2}
  1893.     \hfil}
  1894.  
  1895. % The @error{} command.
  1896. \def\error{\leavevmode\lower.7ex\copy\errorbox}
  1897.  
  1898. % @tex ... @end tex    escapes into raw Tex temporarily.
  1899. % One exception: @ is still an escape character, so that @end tex works.
  1900. % But \@ or @@ will get a plain tex @ character.
  1901.  
  1902. \def\tex{\begingroup
  1903. \catcode `\\=0 \catcode `\{=1 \catcode `\}=2
  1904. \catcode `\$=3 \catcode `\&=4 \catcode `\#=6
  1905. \catcode `\^=7 \catcode `\_=8 \catcode `\~=13 \let~=\tie
  1906. \catcode `\%=14
  1907. \catcode 43=12
  1908. \catcode`\"=12
  1909. \catcode`\==12
  1910. \catcode`\|=12
  1911. \catcode`\<=12
  1912. \catcode`\>=12
  1913. \escapechar=`\\
  1914. %
  1915. \let\{=\ptexlbrace
  1916. \let\}=\ptexrbrace
  1917. \let\.=\ptexdot
  1918. \let\*=\ptexstar
  1919. \let\dots=\ptexdots
  1920. \def\@{@}%
  1921. \let\bullet=\ptexbullet
  1922. \let\b=\ptexb \let\c=\ptexc \let\i=\ptexi \let\t=\ptext \let\l=\ptexl
  1923. \let\L=\ptexL
  1924. %
  1925. \let\Etex=\endgroup}
  1926.  
  1927. % Define @lisp ... @endlisp.
  1928. % @lisp does a \begingroup so it can rebind things,
  1929. % including the definition of @endlisp (which normally is erroneous).
  1930.  
  1931. % Amount to narrow the margins by for @lisp.
  1932. \newskip\lispnarrowing \lispnarrowing=0.4in
  1933.  
  1934. % This is the definition that ^M gets inside @lisp
  1935. % phr: changed space to \null, to avoid overfull hbox problems.
  1936. {\obeyspaces%
  1937. \gdef\lisppar{\null\endgraf}}
  1938.  
  1939. % Cause \obeyspaces to make each Space cause a word-separation
  1940. % rather than the default which is that it acts punctuation.
  1941. % This is because space in tt font looks funny.
  1942. {\obeyspaces %
  1943. \gdef\sepspaces{\def {\ }}}
  1944.  
  1945. \newskip\aboveenvskipamount \aboveenvskipamount= 0pt
  1946. \def\aboveenvbreak{{\advance\aboveenvskipamount by \parskip
  1947. \endgraf \ifdim\lastskip<\aboveenvskipamount
  1948. \removelastskip \penalty-50 \vskip\aboveenvskipamount \fi}}
  1949.  
  1950. \def\afterenvbreak{\endgraf \ifdim\lastskip<\aboveenvskipamount
  1951. \removelastskip \penalty-50 \vskip\aboveenvskipamount \fi}
  1952.  
  1953. \def\lisp{\aboveenvbreak
  1954. \begingroup\inENV % This group ends at the end of the @lisp body
  1955. \hfuzz=12truept % Don't be fussy
  1956. % Make spaces be word-separators rather than space tokens.
  1957. \sepspaces %
  1958. % Single space lines
  1959. \singlespace %
  1960. % The following causes blank lines not to be ignored
  1961. % by adding a space to the end of each line.
  1962. \let\par=\lisppar
  1963. \def\Elisp{\endgroup\afterenvbreak}%
  1964. \parskip=0pt
  1965. \advance \leftskip by \lispnarrowing
  1966. \parindent=0pt
  1967. \let\exdent=\internalexdent
  1968. \obeyspaces \obeylines \tt \rawbackslash
  1969. \def\next##1{}\next}
  1970.  
  1971.  
  1972. \let\example=\lisp
  1973. \def\Eexample{\Elisp}
  1974.  
  1975. \let\smallexample=\lisp
  1976. \def\Esmallexample{\Elisp}
  1977.  
  1978. % Macro for 9 pt. examples, necessary to print with 5" lines.
  1979. % From Pavel@xerox.  This is not really used unless the
  1980. % @smallbook command is given.
  1981.  
  1982. \def\smalllispx{\aboveenvbreak\begingroup\inENV
  1983. %            This group ends at the end of the @lisp body
  1984. \hfuzz=12truept % Don't be fussy
  1985. % Make spaces be word-separators rather than space tokens.
  1986. \sepspaces %
  1987. % Single space lines
  1988. \singlespace %
  1989. % The following causes blank lines not to be ignored
  1990. % by adding a space to the end of each line.
  1991. \let\par=\lisppar
  1992. \def\Esmalllisp{\endgroup\afterenvbreak}%
  1993. \parskip=0pt
  1994. \advance \leftskip by \lispnarrowing
  1995. \parindent=0pt
  1996. \let\exdent=\internalexdent
  1997. \obeyspaces \obeylines \ninett \indexfonts \rawbackslash
  1998. \def\next##1{}\next}
  1999.  
  2000. % This is @display; same as @lisp except use roman font.
  2001.  
  2002. \def\display{\begingroup\inENV %This group ends at the end of the @display body
  2003. \aboveenvbreak
  2004. % Make spaces be word-separators rather than space tokens.
  2005. \sepspaces %
  2006. % Single space lines
  2007. \singlespace %
  2008. % The following causes blank lines not to be ignored
  2009. % by adding a space to the end of each line.
  2010. \let\par=\lisppar
  2011. \def\Edisplay{\endgroup\afterenvbreak}%
  2012. \parskip=0pt
  2013. \advance \leftskip by \lispnarrowing
  2014. \parindent=0pt
  2015. \let\exdent=\internalexdent
  2016. \obeyspaces \obeylines
  2017. \def\next##1{}\next}
  2018.  
  2019. % This is @format; same as @lisp except use roman font and don't narrow margins
  2020.  
  2021. \def\format{\begingroup\inENV %This group ends at the end of the @format body
  2022. \aboveenvbreak
  2023. % Make spaces be word-separators rather than space tokens.
  2024. \sepspaces %
  2025. \singlespace %
  2026. % The following causes blank lines not to be ignored
  2027. % by adding a space to the end of each line.
  2028. \let\par=\lisppar
  2029. \def\Eformat{\endgroup\afterenvbreak}
  2030. \parskip=0pt \parindent=0pt
  2031. \obeyspaces \obeylines
  2032. \def\next##1{}\next}
  2033.  
  2034. % @flushleft and @flushright
  2035.  
  2036. \def\flushleft{%
  2037. \begingroup\inENV %This group ends at the end of the @format body
  2038. \aboveenvbreak
  2039. % Make spaces be word-separators rather than space tokens.
  2040. \sepspaces %
  2041. % The following causes blank lines not to be ignored
  2042. % by adding a space to the end of each line.
  2043. % This also causes @ to work when the directive name
  2044. % is terminated by end of line.
  2045. \let\par=\lisppar
  2046. \def\Eflushleft{\endgroup\afterenvbreak}%
  2047. \parskip=0pt \parindent=0pt
  2048. \obeyspaces \obeylines
  2049. \def\next##1{}\next}
  2050.  
  2051. \def\flushright{%
  2052. \begingroup\inENV %This group ends at the end of the @format body
  2053. \aboveenvbreak
  2054. % Make spaces be word-separators rather than space tokens.
  2055. \sepspaces %
  2056. % The following causes blank lines not to be ignored
  2057. % by adding a space to the end of each line.
  2058. % This also causes @ to work when the directive name
  2059. % is terminated by end of line.
  2060. \let\par=\lisppar
  2061. \def\Eflushright{\endgroup\afterenvbreak}%
  2062. \parskip=0pt \parindent=0pt
  2063. \advance \leftskip by 0pt plus 1fill
  2064. \obeyspaces \obeylines
  2065. \def\next##1{}\next}
  2066.  
  2067. % @quotation - narrow the margins.
  2068.  
  2069. \def\quotation{%
  2070. \begingroup\inENV %This group ends at the end of the @quotation body
  2071. {\parskip=0pt  % because we will skip by \parskip too, later
  2072. \aboveenvbreak}%
  2073. \singlespace
  2074. \parindent=0pt
  2075. \def\Equotation{\par\endgroup\afterenvbreak}%
  2076. \advance \rightskip by \lispnarrowing 
  2077. \advance \leftskip by \lispnarrowing}
  2078.  
  2079. \message{defuns,}
  2080. % Define formatter for defuns
  2081. % First, allow user to change definition object font (\df) internally
  2082. \def\setdeffont #1 {\csname DEF#1\endcsname}
  2083.  
  2084. \newskip\defbodyindent \defbodyindent=.4in
  2085. \newskip\defargsindent \defargsindent=50pt
  2086. \newskip\deftypemargin \deftypemargin=12pt
  2087. \newskip\deflastargmargin \deflastargmargin=18pt
  2088.  
  2089. \newcount\parencount
  2090. % define \functionparens, which makes ( and ) and & do special things.
  2091. % \functionparens affects the group it is contained in.
  2092. \def\activeparens{%
  2093. \catcode`\(=\active \catcode`\)=\active \catcode`\&=\active
  2094. \catcode`\[=\active \catcode`\]=\active}
  2095. {\activeparens % Now, smart parens don't turn on until &foo (see \amprm)
  2096. \gdef\functionparens{\boldbrax\let&=\amprm\parencount=0 }
  2097. \gdef\boldbrax{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb}
  2098.  
  2099. % Definitions of (, ) and & used in args for functions.
  2100. % This is the definition of ( outside of all parentheses.
  2101. \gdef\oprm#1 {{\rm\char`\(}#1 \bf \let(=\opnested %
  2102. \global\advance\parencount by 1 }
  2103. %
  2104. % This is the definition of ( when already inside a level of parens.
  2105. \gdef\opnested{\char`\(\global\advance\parencount by 1 }
  2106. %
  2107. \gdef\clrm{% Print a paren in roman if it is taking us back to depth of 0.
  2108. % also in that case restore the outer-level definition of (.
  2109. \ifnum \parencount=1 {\rm \char `\)}\sl \let(=\oprm \else \char `\) \fi
  2110. \global\advance \parencount by -1 }
  2111. % If we encounter &foo, then turn on ()-hacking afterwards
  2112. \gdef\amprm#1 {{\rm\}\let(=\oprm \let)=\clrm\ }
  2113. %
  2114. \gdef\normalparens{\boldbrax\let&=\ampnr}
  2115. } % End of definition inside \activeparens
  2116. %% These parens (in \boldbrax) actually are a little bolder than the
  2117. %% contained text.  This is especially needed for [ and ]
  2118. \def\opnr{{\sf\char`\(}} \def\clnr{{\sf\char`\)}} \def\ampnr{\&}
  2119. \def\lbrb{{\bf\char`\[}} \def\rbrb{{\bf\char`\]}}
  2120.  
  2121. % First, defname, which formats the header line itself.
  2122. % #1 should be the function name.
  2123. % #2 should be the type of definition, such as "Function".
  2124.  
  2125. \def\defname #1#2{%
  2126. % Get the values of \leftskip and \rightskip as they were
  2127. % outside the @def...
  2128. \dimen2=\leftskip
  2129. \advance\dimen2 by -\defbodyindent
  2130. \dimen3=\rightskip
  2131. \advance\dimen3 by -\defbodyindent
  2132. \noindent        %
  2133. \setbox0=\hbox{\hskip \deflastargmargin{\rm #2}\hskip \deftypemargin}%
  2134. \dimen0=\hsize \advance \dimen0 by -\wd0 % compute size for first line
  2135. \dimen1=\hsize \advance \dimen1 by -\defargsindent %size for continuations
  2136. \parshape 2 0in \dimen0 \defargsindent \dimen1     %
  2137. % Now output arg 2 ("Function" or some such)
  2138. % ending at \deftypemargin from the right margin,
  2139. % but stuck inside a box of width 0 so it does not interfere with linebreaking
  2140. {% Adjust \hsize to exclude the ambient margins,
  2141. % so that \rightline will obey them.
  2142. \advance \hsize by -\dimen2 \advance \hsize by -\dimen3
  2143. \rlap{\rightline{{\rm #2}\hskip \deftypemargin}}}%
  2144. % Make all lines underfull and no complaints:
  2145. \tolerance=10000 \hbadness=10000    
  2146. {\df #1}\enskip        % Generate function name
  2147. }
  2148.  
  2149. % Actually process the body of a definition
  2150. % #1 should be the terminating control sequence, such as \Edefun.
  2151. % #2 should be the "another name" control sequence, such as \defunx.
  2152. % #3 should be the control sequence that actually processes the header,
  2153. %    such as \defunheader.
  2154.  
  2155. \def\defparsebody #1#2#3{\begingroup\inENV% Environment for definitionbody
  2156. \medbreak %
  2157. % Define the end token that this defining construct specifies
  2158. % so that it will exit this group.
  2159. \def#1{\endgraf\endgroup\medbreak}%
  2160. \def#2{\begingroup\obeylines\activeparens\spacesplit#3}%
  2161. \parindent=0in
  2162. \advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindent
  2163. \begingroup %
  2164. \catcode 61=\active %
  2165. \obeylines\activeparens\spacesplit#3}
  2166.  
  2167. \def\defmethparsebody #1#2#3#4 {\begingroup\inENV %
  2168. \medbreak %
  2169. % Define the end token that this defining construct specifies
  2170. % so that it will exit this group.
  2171. \def#1{\endgraf\endgroup\medbreak}%
  2172. \def#2##1 {\begingroup\obeylines\activeparens\spacesplit{#3{##1}}}%
  2173. \parindent=0in
  2174. \advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindent
  2175. \begingroup\obeylines\activeparens\spacesplit{#3{#4}}}
  2176.  
  2177. \def\defopparsebody #1#2#3#4#5 {\begingroup\inENV %
  2178. \medbreak %
  2179. % Define the end token that this defining construct specifies
  2180. % so that it will exit this group.
  2181. \def#1{\endgraf\endgroup\medbreak}%
  2182. \def#2##1 ##2 {\def#4{##1}%
  2183. \begingroup\obeylines\activeparens\spacesplit{#3{##2}}}%
  2184. \parindent=0in
  2185. \advance\leftskip by \defbodyindent \advance \rightskip by \defbodyindent
  2186. \begingroup\obeylines\activeparens\spacesplit{#3{#5}}}
  2187.  
  2188. % Split up #2 at the first space token.
  2189. % call #1 with two arguments:
  2190. %  the first is all of #2 before the space token,
  2191. %  the second is all of #2 after that space token.
  2192. % If #2 contains no space token, all of it is passed as the first arg
  2193. % and the second is passed as empty.
  2194.  
  2195. {\obeylines
  2196. \gdef\spacesplit#1#2^^M{\endgroup\spacesplitfoo{#1}#2 \relax\spacesplitfoo}%
  2197. \long\gdef\spacesplitfoo#1#2 #3#4\spacesplitfoo{%
  2198. \ifx\relax #3%
  2199. #1{#2}{}\else #1{#2}{#3#4}\fi}}
  2200.  
  2201. % So much for the things common to all kinds of definitions.
  2202.  
  2203. % Define @defun.
  2204.  
  2205. % First, define the processing that is wanted for arguments of \defun
  2206. % Use this to expand the args and terminate the paragraph they make up
  2207.  
  2208. \def\defunargs #1{\functionparens \sl
  2209. % Expand, preventing hyphenation at `-' chars.
  2210. % Note that groups don't affect changes in \hyphenchar.
  2211. \hyphenchar\tensl=0
  2212. #1%
  2213. \hyphenchar\tensl=45
  2214. \ifnum\parencount=0 \else \errmessage{unbalanced parens in @def arguments}\fi%
  2215. \interlinepenalty=10000
  2216. \advance\rightskip by 0pt plus 1fil
  2217. \endgraf\penalty 10000\vskip -\parskip\penalty 10000%
  2218. }
  2219.  
  2220. \def\deftypefunargs #1{%
  2221. % Expand, preventing hyphenation at `-' chars.
  2222. % Note that groups don't affect changes in \hyphenchar.
  2223. \functionparens
  2224. \code{#1}%
  2225. \interlinepenalty=10000
  2226. \advance\rightskip by 0pt plus 1fil
  2227. \endgraf\penalty 10000\vskip -\parskip\penalty 10000%
  2228. }
  2229.  
  2230. % Do complete processing of one @defun or @defunx line already parsed.
  2231.  
  2232. % @deffn Command forward-char nchars
  2233.  
  2234. \def\deffn{\defmethparsebody\Edeffn\deffnx\deffnheader}
  2235.  
  2236. \def\deffnheader #1#2#3{\doind {fn}{\code{#2}}%
  2237. \begingroup\defname {#2}{#1}\defunargs{#3}\endgroup %
  2238. \catcode 61=\other % Turn off change made in \defparsebody
  2239. }
  2240.  
  2241. % @defun == @deffn Function
  2242.  
  2243. \def\defun{\defparsebody\Edefun\defunx\defunheader}
  2244.  
  2245. \def\defunheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index
  2246. \begingroup\defname {#1}{Function}%
  2247. \defunargs {#2}\endgroup %
  2248. \catcode 61=\other % Turn off change made in \defparsebody
  2249. }
  2250.  
  2251. % @deftypefun int foobar (int @var{foo}, float @var{bar})
  2252.  
  2253. \def\deftypefun{\defparsebody\Edeftypefun\deftypefunx\deftypefunheader}
  2254.  
  2255. % #1 is the data type.  #2 is the name and args.
  2256. \def\deftypefunheader #1#2{\deftypefunheaderx{#1}#2 \relax}
  2257. % #1 is the data type, #2 the name, #3 the args.
  2258. \def\deftypefunheaderx #1#2 #3\relax{%
  2259. \doind {fn}{\code{#2}}% Make entry in function index
  2260. \begingroup\defname {\code{#1} #2}{Function}%
  2261. \deftypefunargs {#3}\endgroup %
  2262. \catcode 61=\other % Turn off change made in \defparsebody
  2263. }
  2264.  
  2265. % @deftypefn {Library Function} int foobar (int @var{foo}, float @var{bar})
  2266.  
  2267. \def\deftypefn{\defmethparsebody\Edeftypefn\deftypefnx\deftypefnheader}
  2268.  
  2269. % #1 is the classification.  #2 is the data type.  #3 is the name and args.
  2270. \def\deftypefnheader #1#2#3{\deftypefnheaderx{#1}{#2}#3 \relax}
  2271. % #1 is the classification, #2 the data type, #3 the name, #4 the args.
  2272. \def\deftypefnheaderx #1#2#3 #4\relax{%
  2273. \doind {fn}{\code{#3}}% Make entry in function index
  2274. \begingroup\defname {\code{#2} #3}{#1}%
  2275. \deftypefunargs {#4}\endgroup %
  2276. \catcode 61=\other % Turn off change made in \defparsebody
  2277. }
  2278.  
  2279. % @defmac == @deffn Macro
  2280.  
  2281. \def\defmac{\defparsebody\Edefmac\defmacx\defmacheader}
  2282.  
  2283. \def\defmacheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index
  2284. \begingroup\defname {#1}{Macro}%
  2285. \defunargs {#2}\endgroup %
  2286. \catcode 61=\other % Turn off change made in \defparsebody
  2287. }
  2288.  
  2289. % @defspec == @deffn Special Form
  2290.  
  2291. \def\defspec{\defparsebody\Edefspec\defspecx\defspecheader}
  2292.  
  2293. \def\defspecheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index
  2294. \begingroup\defname {#1}{Special Form}%
  2295. \defunargs {#2}\endgroup %
  2296. \catcode 61=\other % Turn off change made in \defparsebody
  2297. }
  2298.  
  2299. % This definition is run if you use @defunx
  2300. % anywhere other than immediately after a @defun or @defunx.
  2301.  
  2302. \def\deffnx #1 {\errmessage{@deffnx in invalid context}}
  2303. \def\defunx #1 {\errmessage{@defunx in invalid context}}
  2304. \def\defmacx #1 {\errmessage{@defmacx in invalid context}}
  2305. \def\defspecx #1 {\errmessage{@defspecx in invalid context}}
  2306. \def\deftypefnx #1 {\errmessage{@deftypefnx in invalid context}}
  2307. \def\deftypeunx #1 {\errmessage{@deftypeunx in invalid context}}
  2308.  
  2309. % @defmethod, and so on
  2310.  
  2311. % @defop {Funny Method} foo-class frobnicate argument
  2312.  
  2313. \def\defop #1 {\def\defoptype{#1}%
  2314. \defopparsebody\Edefop\defopx\defopheader\defoptype}
  2315.  
  2316. \def\defopheader #1#2#3{%
  2317. \dosubind {fn}{\code{#2}}{on #1}% Make entry in function index
  2318. \begingroup\defname {#2}{\defoptype{} on #1}%
  2319. \defunargs {#3}\endgroup %
  2320. }
  2321.  
  2322. % @defmethod == @defop Method
  2323.  
  2324. \def\defmethod{\defmethparsebody\Edefmethod\defmethodx\defmethodheader}
  2325.  
  2326. \def\defmethodheader #1#2#3{%
  2327. \dosubind {fn}{\code{#2}}{on #1}% entry in function index
  2328. \begingroup\defname {#2}{Method on #1}%
  2329. \defunargs {#3}\endgroup %
  2330. }
  2331.  
  2332. % @defcv {Class Option} foo-class foo-flag
  2333.  
  2334. \def\defcv #1 {\def\defcvtype{#1}%
  2335. \defopparsebody\Edefcv\defcvx\defcvarheader\defcvtype}
  2336.  
  2337. \def\defcvarheader #1#2#3{%
  2338. \dosubind {vr}{\code{#2}}{of #1}% Make entry in var index
  2339. \begingroup\defname {#2}{\defcvtype{} of #1}%
  2340. \defvarargs {#3}\endgroup %
  2341. }
  2342.  
  2343. % @defivar == @defcv {Instance Variable}
  2344.  
  2345. \def\defivar{\defmethparsebody\Edefivar\defivarx\defivarheader}
  2346.  
  2347. \def\defivarheader #1#2#3{%
  2348. \dosubind {vr}{\code{#2}}{of #1}% Make entry in var index
  2349. \begingroup\defname {#2}{Instance Variable of #1}%
  2350. \defvarargs {#3}\endgroup %
  2351. }
  2352.  
  2353. % These definitions are run if you use @defmethodx, etc.,
  2354. % anywhere other than immediately after a @defmethod, etc.
  2355.  
  2356. \def\defopx #1 {\errmessage{@defopx in invalid context}}
  2357. \def\defmethodx #1 {\errmessage{@defmethodx in invalid context}}
  2358. \def\defcvx #1 {\errmessage{@defcvx in invalid context}}
  2359. \def\defivarx #1 {\errmessage{@defivarx in invalid context}}
  2360.  
  2361. % Now @defvar
  2362.  
  2363. % First, define the processing that is wanted for arguments of @defvar.
  2364. % This is actually simple: just print them in roman.
  2365. % This must expand the args and terminate the paragraph they make up
  2366. \def\defvarargs #1{\normalparens #1%
  2367. \interlinepenalty=10000
  2368. \endgraf\penalty 10000\vskip -\parskip\penalty 10000}
  2369.  
  2370. % @defvr Counter foo-count
  2371.  
  2372. \def\defvr{\defmethparsebody\Edefvr\defvrx\defvrheader}
  2373.  
  2374. \def\defvrheader #1#2#3{\doind {vr}{\code{#2}}%
  2375. \begingroup\defname {#2}{#1}\defvarargs{#3}\endgroup}
  2376.  
  2377. % @defvar == @defvr Variable
  2378.  
  2379. \def\defvar{\defparsebody\Edefvar\defvarx\defvarheader}
  2380.  
  2381. \def\defvarheader #1#2{\doind {vr}{\code{#1}}% Make entry in var index
  2382. \begingroup\defname {#1}{Variable}%
  2383. \defvarargs {#2}\endgroup %
  2384. }
  2385.  
  2386. % @defopt == @defvr {User Option}
  2387.  
  2388. \def\defopt{\defparsebody\Edefopt\defoptx\defoptheader}
  2389.  
  2390. \def\defoptheader #1#2{\doind {vr}{\code{#1}}% Make entry in var index
  2391. \begingroup\defname {#1}{User Option}%
  2392. \defvarargs {#2}\endgroup %
  2393. }
  2394.  
  2395. % @deftypevar int foobar
  2396.  
  2397. \def\deftypevar{\defparsebody\Edeftypevar\deftypevarx\deftypevarheader}
  2398.  
  2399. % #1 is the data type.  #2 is the name.
  2400. \def\deftypevarheader #1#2{%
  2401. \doind {vr}{\code{#2}}% Make entry in variables index
  2402. \begingroup\defname {\code{#1} #2}{Variable}%
  2403. \interlinepenalty=10000
  2404. \endgraf\penalty 10000\vskip -\parskip\penalty 10000
  2405. \endgroup}
  2406.  
  2407. % @deftypevr {Global Flag} int enable
  2408.  
  2409. \def\deftypevr{\defmethparsebody\Edeftypevr\deftypevrx\deftypevrheader}
  2410.  
  2411. \def\deftypevrheader #1#2#3{\doind {vr}{\code{#3}}%
  2412. \begingroup\defname {\code{#2} #3}{#1}
  2413. \interlinepenalty=10000
  2414. \endgraf\penalty 10000\vskip -\parskip\penalty 10000
  2415. \endgroup}
  2416.  
  2417. % This definition is run if you use @defvarx
  2418. % anywhere other than immediately after a @defvar or @defvarx.
  2419.  
  2420. \def\defvrx #1 {\errmessage{@defvrx in invalid context}}
  2421. \def\defvarx #1 {\errmessage{@defvarx in invalid context}}
  2422. \def\defoptx #1 {\errmessage{@defoptx in invalid context}}
  2423. \def\deftypevarx #1 {\errmessage{@deftypevarx in invalid context}}
  2424. \def\deftypevrx #1 {\errmessage{@deftypevrx in invalid context}}
  2425.  
  2426. % Now define @deftp
  2427. % Args are printed in bold, a slight difference from @defvar.
  2428.  
  2429. \def\deftpargs #1{\bf \defvarargs{#1}}
  2430.  
  2431. % @deftp Class window height width ...
  2432.  
  2433. \def\deftp{\defmethparsebody\Edeftp\deftpx\deftpheader}
  2434.  
  2435. \def\deftpheader #1#2#3{\doind {tp}{\code{#2}}%
  2436. \begingroup\defname {#2}{#1}\deftpargs{#3}\endgroup}
  2437.  
  2438. % This definition is run if you use @deftpx, etc
  2439. % anywhere other than immediately after a @deftp, etc.
  2440.  
  2441. \def\deftpx #1 {\errmessage{@deftpx in invalid context}}
  2442.  
  2443. \message{cross reference,}
  2444. % Define cross-reference macros
  2445. \newwrite \auxfile
  2446.  
  2447. \newif\ifhavexrefs  % True if xref values are known.
  2448. \newif\ifwarnedxrefs  % True if we warned once that they aren't known.
  2449.  
  2450. % \setref{foo} defines a cross-reference point named foo.
  2451.  
  2452. \def\setref#1{%
  2453. %\dosetq{#1-title}{Ytitle}%
  2454. \dosetq{#1-pg}{Ypagenumber}%
  2455. \dosetq{#1-snt}{Ysectionnumberandtype}}
  2456.  
  2457. \def\unnumbsetref#1{%
  2458. %\dosetq{#1-title}{Ytitle}%
  2459. \dosetq{#1-pg}{Ypagenumber}%
  2460. \dosetq{#1-snt}{Ynothing}}
  2461.  
  2462. \def\appendixsetref#1{%
  2463. %\dosetq{#1-title}{Ytitle}%
  2464. \dosetq{#1-pg}{Ypagenumber}%
  2465. \dosetq{#1-snt}{Yappendixletterandtype}}
  2466.  
  2467. % \xref, \pxref, and \ref generate cross-references to specified points.
  2468. % For \xrefX, #1 is the node name, #2 the name of the Info
  2469. % cross-reference, #3 the printed node name, #4 the name of the Info
  2470. % file, #5 the name of the printed manual.  All but the node name can be
  2471. % omitted.
  2472. \def\pxref#1{see \xrefX[#1,,,,,,,]}
  2473. \def\xref#1{See \xrefX[#1,,,,,,,]}
  2474. \def\ref#1{\xrefX[#1,,,,,,,]}
  2475. \def\xrefX[#1,#2,#3,#4,#5,#6]{\begingroup%
  2476. \def\printedmanual{\ignorespaces #5}%
  2477. \def\printednodename{\ignorespaces #3}%
  2478. %
  2479. \setbox1=\hbox{\printedmanual}%
  2480. \setbox0=\hbox{\printednodename}%
  2481. \ifdim \wd0=0pt%
  2482. \def\printednodename{\ignorespaces #1}%
  2483. %%% Uncommment the following line to make the actual chapter or section title
  2484. %%% appear inside the square brackets.
  2485. %\def\printednodename{#1-title}%
  2486. \fi%
  2487. %
  2488. %
  2489. % If we use \unhbox0 and \unhbox1 to print the node names, TeX does
  2490. % not insert empty discretionaries after hyphens, which means that it
  2491. % will not find a line break at a hyphen in a node names.  Since some
  2492. % manuals are best written with fairly long node names, containing
  2493. % hyphens, this is a loss.  Therefore, we simply give the text of
  2494. % the node name again, so it is as if TeX is seeing it for the first
  2495. % time.
  2496. \ifdim \wd1>0pt
  2497. section ``\printednodename'' in \cite{\printedmanual}%
  2498. \else%
  2499. \turnoffactive%
  2500. \refx{#1-snt}{} [\printednodename], page\tie\refx{#1-pg}{}%
  2501. \fi
  2502. \endgroup}
  2503.  
  2504. % \dosetq is the interface for calls from other macros
  2505.  
  2506. % Use \turnoffactive so that punctuation chars such as underscore
  2507. % work in node names.
  2508. \def\dosetq #1#2{{\let\folio=0 \turnoffactive%
  2509. \edef\next{\write\auxfile{\internalsetq {#1}{#2}}}%
  2510. \next}}
  2511.  
  2512. % \internalsetq {foo}{page} expands into
  2513. % CHARACTERS 'xrdef {foo}{...expansion of \Ypage...}
  2514. % When the aux file is read, ' is the escape character
  2515.  
  2516. \def\internalsetq #1#2{'xrdef {#1}{\csname #2\endcsname}}
  2517.  
  2518. % Things to be expanded by \internalsetq
  2519.  
  2520. \def\Ypagenumber{\folio}
  2521.  
  2522. \def\Ytitle{\thischapter}
  2523.  
  2524. \def\Ynothing{}
  2525.  
  2526. \def\Ysectionnumberandtype{%
  2527. \ifnum\secno=0 Chapter\xreftie\the\chapno %
  2528. \else \ifnum \subsecno=0 Section\xreftie\the\chapno.\the\secno %
  2529. \else \ifnum \subsubsecno=0 %
  2530. Section\xreftie\the\chapno.\the\secno.\the\subsecno %
  2531. \else %
  2532. Section\xreftie\the\chapno.\the\secno.\the\subsecno.\the\subsubsecno %
  2533. \fi \fi \fi }
  2534.  
  2535. \def\Yappendixletterandtype{%
  2536. \ifnum\secno=0 Appendix\xreftie'char\the\appendixno{}%
  2537. \else \ifnum \subsecno=0 Section\xreftie'char\the\appendixno.\the\secno %
  2538. \else \ifnum \subsubsecno=0 %
  2539. Section\xreftie'char\the\appendixno.\the\secno.\the\subsecno %
  2540. \else %
  2541. Section\xreftie'char\the\appendixno.\the\secno.\the\subsecno.\the\subsubsecno %
  2542. \fi \fi \fi }
  2543.  
  2544. \gdef\xreftie{'tie}
  2545.  
  2546. % Use TeX 3.0's \inputlineno to get the line number, for better error
  2547. % messages, but if we're using an old version of TeX, don't do anything.
  2548. \ifx\inputlineno\thisisundefined
  2549.   \let\linenumber = \empty % Non-3.0.
  2550. \else
  2551.   \def\linenumber{\the\inputlineno:\space}
  2552. \fi
  2553.  
  2554. % Define \refx{NAME}{SUFFIX} to reference a cross-reference string named NAME.
  2555. % If its value is nonempty, SUFFIX is output afterward.
  2556.  
  2557. \def\refx#1#2{%
  2558.   \expandafter\ifx\csname X#1\endcsname\relax
  2559.     % If not defined, say something at least.
  2560.     $\langle$un\-de\-fined$\rangle$%
  2561.     \ifhavexrefs
  2562.       \message{\linenumber Undefined cross reference `#1'.}%
  2563.     \else
  2564.       \ifwarnedxrefs\else
  2565.         \global\warnedxrefstrue
  2566.         \message{Cross reference values unknown; you must run TeX again.}%
  2567.       \fi
  2568.     \fi
  2569.   \else
  2570.     % It's defined, so just use it.
  2571.     \csname X#1\endcsname
  2572.   \fi
  2573.   #2% Output the suffix in any case.
  2574. }
  2575.  
  2576. % Read the last existing aux file, if any.  No error if none exists.
  2577.  
  2578. % This is the macro invoked by entries in the aux file.
  2579. \def\xrdef #1#2{
  2580. {\catcode`\'=\other\expandafter \gdef \csname X#1\endcsname {#2}}}
  2581.  
  2582. \def\readauxfile{%
  2583. \begingroup
  2584. \catcode `\^^@=\other
  2585. \catcode `\=\other
  2586. \catcode `\=\other
  2587. \catcode `\^^C=\other
  2588. \catcode `\^^D=\other
  2589. \catcode `\^^E=\other
  2590. \catcode `\^^F=\other
  2591. \catcode `\^^G=\other
  2592. \catcode `\^^H=\other
  2593. \catcode `\ =\other
  2594. \catcode `\^^L=\other
  2595. \catcode `\=\other
  2596. \catcode `\=\other
  2597. \catcode `\=\other
  2598. \catcode `\=\other
  2599. \catcode `\=\other
  2600. \catcode `\=\other
  2601. \catcode `\=\other
  2602. \catcode `\=\other
  2603. \catcode `\=\other
  2604. \catcode `\=\other
  2605. \catcode `\=\other
  2606. \catcode `\=\other
  2607. \catcode `\=\other
  2608. \catcode `\^^[=\other
  2609. \catcode `\^^\=\other
  2610. \catcode `\^^]=\other
  2611. \catcode `\^^^=\other
  2612. \catcode `\^^_=\other
  2613. \catcode `\@=\other
  2614. \catcode `\^=\other
  2615. \catcode `\~=\other
  2616. \catcode `\[=\other
  2617. \catcode `\]=\other
  2618. \catcode`\"=\other
  2619. \catcode`\_=\other
  2620. \catcode`\|=\other
  2621. \catcode`\<=\other
  2622. \catcode`\>=\other
  2623. \catcode `\$=\other
  2624. \catcode `\#=\other
  2625. \catcode `\&=\other
  2626. % the aux file uses ' as the escape.
  2627. % Turn off \ as an escape so we do not lose on
  2628. % entries which were dumped with control sequences in their names.
  2629. % For example, 'xrdef {$\leq $-fun}{page ...} made by @defun ^^
  2630. % Reference to such entries still does not work the way one would wish,
  2631. % but at least they do not bomb out when the aux file is read in.
  2632. \catcode `\{=1 \catcode `\}=2
  2633. \catcode `\%=\other
  2634. \catcode `\'=0
  2635. \catcode `\\=\other
  2636. \openin 1 \jobname.aux
  2637. \ifeof 1 \else \closein 1 \input \jobname.aux \global\havexrefstrue
  2638. \fi
  2639. % Open the new aux file.  Tex will close it automatically at exit.
  2640. \openout \auxfile=\jobname.aux
  2641. \endgroup}
  2642.  
  2643.  
  2644. % Footnotes.
  2645.  
  2646. \newcount \footnoteno
  2647.  
  2648. \def\supereject{\par\penalty -20000\footnoteno =0 }
  2649.  
  2650. \let\ptexfootnote=\footnote
  2651.  
  2652. {\catcode `\@=11
  2653. \long\gdef\footnote #1{\global\advance \footnoteno by \@ne
  2654. \removelastskip
  2655. \edef\thisfootno{$^{\the\footnoteno}$}%
  2656. \let\@sf\empty
  2657. \ifhmode\edef\@sf{\spacefactor\the\spacefactor}\/\fi
  2658. \thisfootno\@sf \footnotezzz{#1}}
  2659. % \parsearg\footnotezzz}
  2660.  
  2661. \long\gdef\footnotezzz #1{\insert\footins{
  2662. \interlinepenalty\interfootnotelinepenalty
  2663. \splittopskip\ht\strutbox % top baseline for broken footnotes
  2664. \splitmaxdepth\dp\strutbox \floatingpenalty\@MM
  2665. \leftskip\z@skip \rightskip\z@skip \spaceskip\z@skip \xspaceskip\z@skip
  2666. \footstrut\parindent=\defaultparindent\hang\textindent{\thisfootno}#1\strut}}
  2667.  
  2668. }%end \catcode `\@=11
  2669.  
  2670. % End of control word definitions.
  2671.  
  2672. \message{and turning on texinfo input format.}
  2673.  
  2674. \def\openindices{%
  2675.    \newindex{cp}%
  2676.    \newcodeindex{fn}%
  2677.    \newcodeindex{vr}%
  2678.    \newcodeindex{tp}%
  2679.    \newcodeindex{ky}%
  2680.    \newcodeindex{pg}%
  2681. }
  2682.  
  2683. % Set some numeric style parameters, for 8.5 x 11 format.
  2684.  
  2685. %\hsize = 6.5in
  2686. \newdimen\defaultparindent \defaultparindent = 15pt
  2687. \parindent = \defaultparindent
  2688. \parskip 18pt plus 1pt
  2689. \baselineskip 15pt
  2690. \advance\topskip by 1.2cm
  2691.  
  2692. % Prevent underfull vbox error messages.
  2693. \vbadness=10000
  2694.  
  2695. % Use TeX 3.0's \emergencystretch to help line breaking, but if we're
  2696. % using an old version of TeX, don't do anything.  We want the amount of
  2697. % stretch added to depend on the line length, hence the dependence on
  2698. % \hsize.  This makes it come to about 9pt for the 8.5x11 format.
  2699. \ifx\emergencystretch\thisisundefined \else
  2700.   \emergencystretch = \hsize
  2701.   \divide\emergencystretch by 45
  2702. \fi
  2703.  
  2704. % Use @smallbook to reset parameters for 7x9.5 format
  2705. \def\smallbook{
  2706. \global\lispnarrowing = 0.3in
  2707. \global\baselineskip 12pt
  2708. \global\parskip 3pt plus 1pt
  2709. \global\hsize = 5in
  2710. \global\doublecolumnhsize=2.4in \global\doublecolumnvsize=15.0in
  2711. \global\vsize=7.5in
  2712. \global\tolerance=700
  2713. \global\hfuzz=1pt
  2714.  
  2715. \global\pagewidth=\hsize
  2716. \global\pageheight=\vsize
  2717.  
  2718. \global\let\smalllisp=\smalllispx
  2719. \global\let\smallexample=\smalllispx
  2720. \global\def\Esmallexample{\Esmalllisp}
  2721. }
  2722.  
  2723. %% For a final copy, take out the rectangles
  2724. %% that mark overfull boxes (in case you have decided
  2725. %% that the text looks ok even though it passes the margin).
  2726. \def\finalout{\overfullrule=0pt}
  2727.  
  2728. % Define macros to output various characters with catcode for normal text.
  2729. \catcode`\"=\other
  2730. \catcode`\~=\other
  2731. \catcode`\^=\other
  2732. \catcode`\_=\other
  2733. \catcode`\|=\other
  2734. \catcode`\<=\other
  2735. \catcode`\>=\other
  2736. \catcode`\+=\other
  2737. \def\normaldoublequote{"}
  2738. \def\normaltilde{~}
  2739. \def\normalcaret{^}
  2740. \def\normalunderscore{_}
  2741. \def\normalverticalbar{|}
  2742. \def\normalless{<}
  2743. \def\normalgreater{>}
  2744. \def\normalplus{+}
  2745.  
  2746. % This macro is used to make a character print one way in ttfont
  2747. % where it can probably just be output, and another way in other fonts,
  2748. % where something hairier probably needs to be done.
  2749. %
  2750. % #1 is what to print if we are indeed using \tt; #2 is what to print
  2751. % otherwise.  Since all the Computer Modern typewriter fonts have zero
  2752. % interword stretch (and shrink), and it is reasonable to expect all
  2753. % typewriter fonts to have this, we can check that font parameter.
  2754. \def\ifusingtt#1#2{\ifdim \fontdimen3\the\font=0pt #1\else #2\fi}
  2755.  
  2756. % Turn off all special characters except @
  2757. % (and those which the user can use as if they were ordinary).
  2758. % Most of these we simply print from the \tt font, but for some, we can
  2759. % use math or other variants that look better in normal text.
  2760.  
  2761. \catcode`\"=\active
  2762. \def\activedoublequote{{\tt \char '042}}
  2763. \let"=\activedoublequote
  2764. \catcode`\~=\active
  2765. \def~{{\tt \char '176}}
  2766. \chardef\hat=`\^
  2767. \catcode`\^=\active
  2768. \def^{{\tt \hat}}
  2769.  
  2770. \catcode`\_=\active
  2771. \def_{\ifusingtt\normalunderscore\_}
  2772. % Subroutine for the previous macro.
  2773. \def\_{\lvvmode \kern.06em \vbox{\hrule width.3em height.1ex}}
  2774.  
  2775. % \lvvmode is equivalent in function to \leavevmode.
  2776. % Using \leavevmode runs into trouble when written out to
  2777. % an index file due to the expansion of \leavevmode into ``\unhbox
  2778. % \voidb@x'' ---which looks to TeX like ``\unhbox \voidb\x'' due to our
  2779. % magic tricks with @.
  2780. \def\lvvmode{\vbox to 0pt{}}
  2781.  
  2782. \catcode`\|=\active
  2783. \def|{{\tt \char '174}}
  2784. \chardef \less=`\<
  2785. \catcode`\<=\active
  2786. \def<{{\tt \less}}
  2787. \chardef \gtr=`\>
  2788. \catcode`\>=\active
  2789. \def>{{\tt \gtr}}
  2790. \catcode`\+=\active
  2791. \def+{{\tt \char 43}}
  2792. %\catcode 27=\active
  2793. %\def^^[{$\diamondsuit$}
  2794.  
  2795. % Used sometimes to turn off (effectively) the active characters
  2796. % even after parsing them.
  2797. \def\turnoffactive{\let"=\normaldoublequote
  2798. \let~=\normaltilde
  2799. \let^=\normalcaret
  2800. \let_=\normalunderscore
  2801. \let|=\normalverticalbar
  2802. \let<=\normalless
  2803. \let>=\normalgreater
  2804. \let+=\normalplus}
  2805.  
  2806. % Set up an active definition for =, but don't enable it most of the time.
  2807. {\catcode`\==\active
  2808. \global\def={{\tt \char 61}}}
  2809.  
  2810. \catcode`\@=0
  2811.  
  2812. % \rawbackslashxx output one backslash character in current font
  2813. \global\chardef\rawbackslashxx=`\\
  2814. %{\catcode`\\=\other
  2815. %@gdef@rawbackslashxx{\}}
  2816.  
  2817. % \rawbackslash redefines \ as input to do \rawbackslashxx.
  2818. {\catcode`\\=\active
  2819. @gdef@rawbackslash{@let\=@rawbackslashxx }}
  2820.  
  2821. % \normalbackslash outputs one backslash in fixed width font.
  2822. \def\normalbackslash{{\tt\rawbackslashxx}}
  2823.  
  2824. % Say @foo, not \foo, in error messages.
  2825. \escapechar=`\@
  2826.  
  2827. % \catcode 17=0   % Define control-q
  2828. \catcode`\\=\active
  2829.  
  2830. % If a .fmt file is being used, we don't want the `\input texinfo' to show up.
  2831. % That is what \eatinput is for; after that, the `\' should revert to printing 
  2832. % a backslash.
  2833. %
  2834. @gdef@eatinput input texinfo{@fixbackslash}
  2835. @global@let\ = @eatinput
  2836.  
  2837. % On the other hand, perhaps the file did not have a `\input texinfo'. Then
  2838. % the first `\{ in the file would cause an error. This macro tries to fix 
  2839. % that, assuming it is called before the first `\' could plausibly occur.
  2840. @gdef@fixbackslash{@ifx\@eatinput @let\ = @normalbackslash @fi}
  2841.  
  2842. %% These look ok in all fonts, so just make them not special.  The @rm below
  2843. %% makes sure that the current font starts out as the newly loaded cmr10
  2844. @catcode`@$=@other @catcode`@%=@other @catcode`@&=@other @catcode`@#=@other
  2845.  
  2846. @textfonts
  2847. @rm
  2848.  
  2849. @c Local variables:
  2850. @c page-delimiter: "^\\\\message"
  2851. @c End:
  2852.